aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Makefile.in6
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/ERC-NEWS599
-rw-r--r--etc/NEWS11
-rw-r--r--info/dir2
-rw-r--r--lisp/erc/ChangeLog327
-rw-r--r--lisp/erc/ChangeLog.20011042
-rw-r--r--lisp/erc/ChangeLog.20022601
-rw-r--r--lisp/erc/ChangeLog.20032145
-rw-r--r--lisp/erc/ChangeLog.20042074
-rw-r--r--lisp/erc/ChangeLog.20051222
-rw-r--r--lisp/erc/erc-autoaway.el207
-rw-r--r--lisp/erc/erc-autojoin.el139
-rw-r--r--lisp/erc/erc-backend.el1786
-rw-r--r--lisp/erc/erc-button.el504
-rw-r--r--lisp/erc/erc-compat.el207
-rw-r--r--lisp/erc/erc-complete.el222
-rw-r--r--lisp/erc/erc-dcc.el1135
-rw-r--r--lisp/erc/erc-ezbounce.el180
-rw-r--r--lisp/erc/erc-fill.el197
-rw-r--r--lisp/erc/erc-goodies.el522
-rw-r--r--lisp/erc/erc-ibuffer.el184
-rw-r--r--lisp/erc/erc-identd.el87
-rw-r--r--lisp/erc/erc-imenu.el143
-rw-r--r--lisp/erc/erc-lang.el213
-rw-r--r--lisp/erc/erc-list.el396
-rw-r--r--lisp/erc/erc-log.el358
-rw-r--r--lisp/erc/erc-match.el658
-rw-r--r--lisp/erc/erc-menu.el121
-rw-r--r--lisp/erc/erc-nets.el861
-rw-r--r--lisp/erc/erc-netsplit.el212
-rw-r--r--lisp/erc/erc-nicklist.el411
-rw-r--r--lisp/erc/erc-nickserv.el337
-rw-r--r--lisp/erc/erc-notify.el254
-rw-r--r--lisp/erc/erc-page.el108
-rw-r--r--lisp/erc/erc-pcomplete.el275
-rw-r--r--lisp/erc/erc-replace.el93
-rw-r--r--lisp/erc/erc-ring.el148
-rw-r--r--lisp/erc/erc-sound.el149
-rw-r--r--lisp/erc/erc-speedbar.el369
-rw-r--r--lisp/erc/erc-spelling.el93
-rw-r--r--lisp/erc/erc-stamp.el335
-rw-r--r--lisp/erc/erc-track.el839
-rw-r--r--lisp/erc/erc-truncate.el121
-rw-r--r--lisp/erc/erc-viper.el74
-rw-r--r--lisp/erc/erc-xdcc.el130
-rw-r--r--lisp/erc/erc.el6144
-rw-r--r--man/ChangeLog8
-rw-r--r--man/Makefile.in9
-rw-r--r--man/erc.texi624
-rw-r--r--man/faq.texi2
-rw-r--r--man/makefile.w32-in9
53 files changed, 28894 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 267a7622e7b..37e9613c706 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12006-01-29 Michael Olson <mwolson@gnu.org>
2
3 * Makefile.in (install-arch-indep, uninstall): Add ERC.
4 * info/dir (ERC): New entry.
5
12006-01-29 Eli Zaretskii <eliz@gnu.org> 62006-01-29 Eli Zaretskii <eliz@gnu.org>
2 7
3 * info/dir: Fix last change. 8 * info/dir: Fix last change.
diff --git a/Makefile.in b/Makefile.in
index 26b2e291367..8468d13b803 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -497,7 +497,7 @@ install-arch-indep: mkdir info
497 chmod a+r ${infodir}/dir); \ 497 chmod a+r ${infodir}/dir); \
498 fi; \ 498 fi; \
499 cd ${srcdir}/info ; \ 499 cd ${srcdir}/info ; \
500 for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* emacs-mime* emacs-xtra* eshell* eudc* flymake* forms* gnus* idlwave* info* message* mh-e* newsticker* org* pcl-cvs* pgg* reftex* sc* ses* sieve* speedbar* tramp* vip* widget* woman* smtpmail* url* rcirc*; do \ 500 for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* emacs-mime* emacs-xtra* eshell* eudc* flymake* forms* gnus* idlwave* info* message* mh-e* newsticker* org* pcl-cvs* pgg* reftex* sc* ses* sieve* speedbar* tramp* vip* widget* woman* smtpmail* url* rcirc* erc*; do \
501 (cd $${thisdir}; \ 501 (cd $${thisdir}; \
502 ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \ 502 ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \
503 chmod a+r ${infodir}/$$f); \ 503 chmod a+r ${infodir}/$$f); \
@@ -507,7 +507,7 @@ install-arch-indep: mkdir info
507 thisdir=`/bin/pwd`; \ 507 thisdir=`/bin/pwd`; \
508 if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \ 508 if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \
509 then \ 509 then \
510 for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime emacs-xtra eshell eudc flymake forms gnus idlwave info message mh-e newsticker org pcl-cvs pgg reftex sc ses sieve speedbar tramp vip viper widget woman smtpmail url rcirc; do \ 510 for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime emacs-xtra eshell eudc flymake forms gnus idlwave info message mh-e newsticker org pcl-cvs pgg reftex sc ses sieve speedbar tramp vip viper widget woman smtpmail url rcirc erc; do \
511 (cd $${thisdir}; \ 511 (cd $${thisdir}; \
512 ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/$$f); \ 512 ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/$$f); \
513 done; \ 513 done; \
@@ -573,7 +573,7 @@ uninstall:
573 done 573 done
574 (cd ${archlibdir} && rm -f fns-*) 574 (cd ${archlibdir} && rm -f fns-*)
575 -rm -rf ${libexecdir}/emacs/${version} 575 -rm -rf ${libexecdir}/emacs/${version}
576 (cd ${infodir} && rm -f cl* ada-mode* autotype* calc* ccmode* ebrowse* efaq* eintr elisp* eshell* eudc* idlwave* message* pcl-cvs* reftex* speedbar* tramp* widget* woman* dired-x* ediff* emacs* emacs-xtra* flymake* forms* gnus* info* mh-e* newsticker* org* sc* ses* vip* smtpmail* url* rcirc*) 576 (cd ${infodir} && rm -f cl* ada-mode* autotype* calc* ccmode* ebrowse* efaq* eintr elisp* eshell* eudc* idlwave* message* pcl-cvs* reftex* speedbar* tramp* widget* woman* dired-x* ediff* emacs* emacs-xtra* flymake* forms* gnus* info* mh-e* newsticker* org* sc* ses* vip* smtpmail* url* rcirc* erc*)
577 (cd ${man1dir} && rm -f emacs${manext} emacsclient${manext} etags${manext} ctags${manext}) 577 (cd ${man1dir} && rm -f emacs${manext} emacsclient${manext} etags${manext} ctags${manext})
578 (cd ${bindir} && rm -f $(EMACSFULL) $(EMACS)) 578 (cd ${bindir} && rm -f $(EMACSFULL) $(EMACS))
579 579
diff --git a/etc/ChangeLog b/etc/ChangeLog
index e3ee6b34939..7d975861e63 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
12006-01-29 Michael Olson <mwolson@gnu.org>
2
3 * NEWS: Add entry for ERC.
4
12006-01-27 Chong Yidong <cyd@stupidchicken.com> 52006-01-27 Chong Yidong <cyd@stupidchicken.com>
2 6
3 * TODO: Make SYNC_INPUT the default. 7 * TODO: Make SYNC_INPUT the default.
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
new file mode 100644
index 00000000000..fea5497a4a5
--- /dev/null
+++ b/etc/ERC-NEWS
@@ -0,0 +1,599 @@
1ERC NEWS -*- outline -*-
2
3* Changes since ERC 5.0.4
4
5** Improve XEmacs compatibility.
6
7** Namespace changes
8
9*** Now ERC doesn't use global variable space.
10Renamed all variables that didn't start with "erc-".
11
12 o `away' is now `erc-away'
13
14 o `current-nick' is now `erc-server-current-nick'
15
16 o `last-peers' is now `erc-server-last-peers'
17
18 o `last-ping-time' is now `erc-server-last-ping-time'
19
20 o `last-sent-time' is now `erc-server-last-sent-time'
21
22 o `lines-sent' is now `erc-server-lines-sent'
23
24 o `quitting' is now `erc-server-quitting'
25
26*** Remove the `with-erc-channel-buffer' function.
27
28** Bugfixes
29
30*** Don't inadvertently destroy face properties.
31
32*** Load erc scripts in a safer way.
33
34*** Don't insert a timestamp if text at point is invisible.
35
36*** Don't hide messages from those in `erc-fools' by default.
37Color their nicks instead.
38
39*** Use a more foolproof method of encoding and decoding strings
40before sending to a channel.
41
42** Backend changes
43
44*** Renamed some server-specific variables
45
46 o `erc-announced-server-name' is now `erc-server-announced-name'
47
48 o `erc-auto-reconnect' is now `erc-server-auto-reconnect'
49
50 o `erc-connect-function' is now `erc-server-connect-function'
51
52 o `erc-default-coding-system' is now `erc-server-coding-system'
53
54 o `erc-duplicate-timeout' is now `erc-server-duplicate-timeout'
55
56 o `erc-duplicates' is now `erc-server-duplicates'
57
58 o `erc-lag' is now `erc-server-lag'
59
60 o `erc-prevent-duplicates' is now `erc-server-prevent-duplicates'
61
62 o `erc-previous-read' is now `erc-server-filter-data'
63
64 o `erc-process' is now `erc-server-process'
65
66 o `erc-ping-handler' is now `erc-server-send-ping-handler'
67
68 o `erc-ping-interval' is now `erc-server-send-ping-interval'
69
70*** Renamed some functions
71
72 o `erc-connect' is now `erc-server-connect'
73
74 o `erc-process-filter' is now `erc-server-filter-function'
75
76 o `erc-send-command' is now `erc-server-send'
77
78 o `erc-send-single-line' is now `erc-send-input'
79
80 o `erc-setup-periodical-server-ping' is now
81 `erc-server-setup-periodical-server-ping'
82
83 o `erc-split-command is now `erc-split-line'
84
85*** New options
86
87 o erc-server-flood-margin, erc-server-flood-penalty: New options
88 that allow tweaking of flood control.
89
90 o erc-split-line-length: The maximum line length of a single
91 message.
92
93*** New variables
94
95 o erc-server-flood-last-message, erc-server-flood-queue,
96 erc-server-flood-timer: Flood control.
97
98 o erc-server-processing-p: Indicate when we're currently processing
99 a message.
100
101*** Remove some options
102
103 o `erc-flood-limit'
104 o `erc-flood-limit2'
105
106** New customization group `erc-server' for dealing with IRC servers.
107
108** ERC can now be installed by doing `make install' from the command line.
109
110** ERC now has a manual in erc.texi.
111Type `make doc' to generate HTML and Info versions of it.
112
113** ERC no longer depends on cl.el.
114Only the macros in cl-macs.el are used.
115
116** Fix an edge case when quitting as new messages come in.
117
118** Make flood protection toggle-able as on/off, removing the 'strict option.
119
120** If possible, re-use channel buffers when reconnecting to a server.
121
122** Text in ERC buffers is now read-only by default.
123To get the previous behavior,
124
125** Changes and additions to modules
126
127*** Auto-join (erc-autojoin.el)
128
129**** Recognize the Azzurra server.
130
131*** BBDB (erc-bbdb.el)
132
133**** When the user types /WHOIS, ask for a record to merge to.
134
135**** Store the displayed name of a BitlBee contact.
136The new `erc-bbdb-bitlbee-name-field' option specifies the field to use
137to store this information.
138
139**** Don't prompt for a name on /JOIN or /NICK.
140
141*** Button (erc-button.el)
142
143**** Fix customization of `erc-button-alist'
144
145**** New option `erc-button-nickname-face' determines the face to use
146when coloring ERC nicknames.
147
148*** Channel tracking (erc-track.el)
149
150**** Remove channels from the modified channels list if not currently
151connected. This should remove residue from the mode line after
152quitting ERC.
153
154**** Recognize buttonized text
155
156*** Highlighting (erc-match.el)
157
158**** Highlight current nickname by default.
159
160**** Added the option of beeping when certain matches occur.
161Add `erc-beep-on-match' to `erc-text-matched-hook' to enable
162beeping. Set the new variable `erc-beep-match-types' which match
163types that make beeps.
164
165*** Nicklist (erc-nicklist.el)
166
167**** Fix a couple of errors.
168
169**** Make sure a stray mouse click doesn't trigger an error.
170
171**** Insert icons from the /images directory next to nicks.
172This indicates their away status. The location is customizable via
173the new `erc-nicklist-icons-directory' option.
174
175If you do not want these icons, set `erc-nicklist-use-icons' to nil.
176
177*** Nickserv identification (erc-nickserv.el)
178
179**** Recognize Azzurra and OFTC networks.
180
181*** Old completion (erc-complete.el)
182
183**** Disable by default.
184
185*** Programmable completion (erc-pcomplete.el)
186
187**** Enable by default.
188
189*** Timestamps (erc-stamp.el)
190
191**** On Emacs22, align right timestamps perfectly, even if variable-width
192characters are used. If we aren't using Emacs22, move text farther
193away from the right margin when variable-width characters are used.
194It is considered better to misalign the stamp by a bit than to go past
195the right margin.
196
197**** Enable by default
198
199** New modules
200
201*** Spell-checking (erc-spelling.el)
202
203**** Use flyspell in ERC.
204
205*** Viper compatibility (erc-viper.el)
206
207**** Helps ERC work correctly in viper-mode.
208
209* Fixes since ERC 5.0.3
210
211** Fix a problem with undo in channels.
212
213* Fixes since ERC 5.0.2
214
215** Fix typo in the `ctcp-request-to' entry of the English catalog.
216
217** Debugging with edegug has been made easier in all of the
218erc-with-* and with-erc* macros.
219
220** Non-ASCII character sets should be better supported when sending
221and processing messages.
222
223** A load failure with erc-autoaway.el and Emacs21 has been fixed.
224
225** A few XEmacs warnings were fixed.
226
227** Changes and additions to modules
228
229*** Backend (erc-backend.el)
230
231**** Move the check for hidden messages into `erc-display-message'
232so there isn't so much replicated code.
233
234**** Add `definition-name' property to constructed symbols so that
235`find-function' and `find-variable' will be able to locate them.
236
237**** Make sure logs are inserted info the correct channel buffers.
238There was previously an error when using `erc-insert-log-on-open' in
239combination with autojoin to multiple channels.
240
241*** Button (erc-button.el)
242
243**** The layering of `erc-button-face' on other faces in ERC buffers
244has been improved.
245
246*** Channel tracking (erc-track.el)
247
248**** Use optimal amount of whitespace around modified channels
249indicator. Previously, there was an additional unnecessary space.
250
251**** Fix an error that occurred when unchecked buffers existed when
252invoking /QUIT.
253
254* Fixes since ERC 5.0.1
255
256** If a channel key is required for a certain channel, ERC will prompt
257for one if `erc-prompt-for-channel-key' is non-nil.
258
259** ERC doesn't try to reconnect if the network connection is refused
260when using `open-network-stream-nowait' as the `erc-connect-function'.
261
262** Messages from multiple servers will not go to the currently active
263buffer. The messages from each server will be contained in the most
264recently active channel/server buffer that corresponds with the
265server.
266
267** Some text messages were cleaned up slightly.
268
269** Button faces should no longer "cover" other faces.
270
271** Made some XEmacs compatibility fixes.
272
273** Nicknames containing a backslash are now correctly highlighted as
274current-nick and buttonized as nicks.
275
276** `erc-server-select' doesn't offer networks without servers as a
277choice anymore.
278
279** Non-ASCII character support has been improved.
280
281** Changes and additions to modules
282
283*** Menu (erc-menu.el)
284
285**** You can now save logs and truncate buffers from the menu-bar.
286
287* Fixes since ERC 5.0
288
289** Narrowing in ERC buffers no longer causes formatting errors.
290
291** The BBDB module now loads correctly when customizing `erc-modules'.
292
293** The value of `erc-button-face' is now respected.
294
295** Fixed a bug which caused a read-only error during connection.
296
297** Server buffers are now tracked correctly.
298This means that `erc-track-priority-faces-only', `erc-track-exclude',
299and `erc-track-exclude-types' now work with server buffers.
300
301* Changes since ERC 4.0
302
303** Channel members are now stored as a hash-table.
304`erc-server-users' and `erc-channel-users' are now hash-tables, rather
305than alists. This significantly increases performance, especially in
306large channels. Each channel member is stored as an `erc-server-user'
307struct, with additional information about the channels they are on
308stored in an `erc-channel-user' struct. Code using old alist-style
309channel members needs to be updated to work with hash-tables.
310This new code also removes the need for erc-members.el, which has been
311removed.
312
313** The way ERC deals with input from the server has changed.
314All server response code is now in a new file, erc-backend.el. There
315should be no real user visible changes. There are, however, a few
316major changes for implementers, and module writers:
317
318*** The PARSED response that all handlers get called with is
319 no longer a vector, but an `erc-response' struct.
320
321 This means LESS MAGIC NUMBERS in the ERC source code, but a few
322 changes in how you get at parsed responses.
323
324 The sender is accessed via `erc-response.sender'.
325
326 The command is accessed via `erc-response.command'.
327
328 The arguments to the command (everything after the command and
329 before the colon) are accessed via `erc-response.command-args'.
330 This is a /list/ of arguments in the order they appear in the
331 unparsed response.
332
333 The contents of the response is accessed via
334 `erc-response.contents'.
335
336 Should, for some reason, you want to do something with the
337 /unparsed/ response, you can get it via `erc-response.unparsed'.
338
339*** The `erc-server-hook-list' mechanism is gone.
340
341 All server response handlers should be defined with
342 `define-erc-response-handler'. This defines functions and
343 corresponding hook variables.
344
345 The mapping of server commands to hook variables is no longer
346 done via `erc-event-to-hook', but through an #'equal hashtable,
347 `erc-server-responses'. In order to find a hook you do:
348
349 (erc-get-hook command)
350
351 See the docstring of `define-erc-response-handler' for more
352 information.
353
354*** ALL hook variables have been renamed.
355
356 In accordance with recommendations in the Emacs Lisp manual,
357 the hook variables are no longer called `erc-server-FOO-hook',
358 but rather `erc-server-FOO-functions'. This is to indicate
359 that the functions they call take arguments.
360
361 All the modules in ERC have been updated to reflect this change,
362 but external module authors should beware.
363
364** The values of `erc-mode-line-format' and `erc-header-line-format'
365are now defined as strings to be formatted using `format-spec'.
366`erc-mode-line-format' does not replace the whole mode-line anymore,
367only `mode-line-buffer-identification' is set. This way, personal
368mode-line configurations are not modified and all key bindings work as
369expected. The process status (connecting, closed) is now shown in
370`mode-line-process'.
371
372** Customization of ERC variables has been made easier. Variables
373have been split into more groups for better organization.
374
375** New variables
376
377 o `erc-send-whitespace-lines' - Set this to send lines even if they
378 are empty.
379
380 o `erc-manual-set-nick-on-bad-nick-p' - If the nickname you chose is
381 already taken or not allowed, your nick is not changed and you can
382 try again manually if this is non-nil.
383
384 o `erc-mode-line-away-status-format' - You can now set what is shown
385 in the mode-line when you are away.
386
387 o `erc-header-line-uses-help-echo-p' - The header-line now uses the
388 help-echo property. You can set this to nil to disable it.
389
390 o `erc-format-query-as-channel-p' - Set this to nil to have messages
391 in the query buffer formatted like private messages.
392
393 o `erc-show-channel-key-p' - The channel key is now shown with the
394 other channel modes in the header line. Set this to nil if you
395 want it hidden.
396
397 o `erc-prompt-for-channel-key' - Set this if you want to be prompted
398 for the channel key (channel's mode is +k) when you call
399 `erc-join-channel' interactively.
400
401 o `erc-kill-server-buffer-on-quit' - If non-nil, kill the server
402 buffer automatically when you quit.
403
404** New hooks
405
406 o `erc-join-hook' - Called when you join a channel.
407
408 o `erc-kick-hook' - Called when you are kicked from a channel. The
409 channel's buffer is sent as an argument to functions called from
410 this hook.
411
412 o `erc-nick-changed-functions' - Whenever your nickname changes
413 successfully, the functions in this hook are run with the
414 arguments NEW-NICK and OLD-NICK.
415
416** New command /WHOAMI - Do a /WHOIS on your current nickname.
417
418** The key binding for changing channel modes is now C-c C-o.
419
420** Removed variables
421
422 o `erc-echo-notices-in-minibuffer-flag' and
423 `erc-echo-notices-in-current-buffer' - You should use
424 `erc-echo-notice-hook' and `erc-echo-notice-always-hook' instead.
425
426 o `erc-prompt-interactive-input' has been removed (commented out)
427 because nickname completion does not work with it.
428
429 o All INFO buffer-related variables and functions have been removed.
430
431** You can now disable modules by setting `erc-modules' with the
432customization interface.
433
434** Changes and additions to modules
435
436*** Autoaway (erc-autoaway.el)
437
438**** New variable `erc-autoaway-no-auto-back-regexp' - Add text which,
439when you type anything matching it, will not automatically discard
440your away status when `erc-auto-discard-away' is non-nil.
441
442*** Filling (erc-fill.el)
443
444**** New variable `erc-fill-variable-maximum-indentation' - Don't
445indent more than this many characters when indenting a message from a
446user with a long nickname.
447
448*** Goodies (erc-goodies.el)
449
450**** Miscellaneous small modules have been moved from erc.el.
451The functions erc-add-scroll-to-bottom, erc-make-read-only,
452erc-send-distinguish-noncommands, erc-interpret-controls, erc-unmorse,
453erc-smiley, and erc-occur, which were defined in the main erc.el file
454have been moved to erc-goodies.el and have mostly been translated to
455the modules scrolltobottom, readonly, noncommands, irccontrols, smiley
456and unmorse.
457
458**** New variables
459
460 o `erc-input-line-position' - The line number to use with
461 `erc-scroll-to-bottom'.
462
463 o `erc-beep-p' - Beep if there is a \C-g control character in a
464 message.
465
466*** Channel lists (erc-list.el)
467
468**** New variable `erc-chanlist-highlight-face' - A face used for
469highlighting the current line.
470
471*** Highlighting (erc-match.el)
472
473**** `erc-current-nick-highlight-type' has new options: 'keyword and
474'nick-or-keyword.
475
476*** Menu (erc-menu.el)
477
478**** The `IRC' menu is now automatically added to `erc-mode' buffers.
479
480*** Networks (erc-nets.el)
481
482**** The functions for determining current network are in this file.
483There were a couple of functions spread about in different files which
484each had a different way of determining the current network. The
485methods have been combined, and the big list of known networks
486(`erc-networks-alist') is being put to use. You can access the
487network's name by calling the new function `erc-network'. This
488returns the name of the current network as a symbol or 'Unknown if it
489could not determine which network it is.
490
491*** Nicklist (erc-nicklist.el)
492
493**** ERC has a new way of displaying nicknames in a channel.
494The new file erc-nicklist.el defines a new command `erc-nicklist'
495which pops up a small Emacs window showing the nicknames of all
496members of the current channel. The implementation is not complete
497and is rather proof-of-concept for now. The result is something a bit
498like erc-speedbar, but not quite as invasive, and doesn't require use
499of a new frame.
500
501*** Internet services / Nickserv (erc-nickserv.el)
502
503**** Network detection is now taken care of by erc-nets.el.
504The function `erc-current-network' is deprecated, use `erc-network'
505instead. The variable `erc-networks' has been removed, use
506`erc-networks-alist'. The network symbols used in
507`erc-nickserv-alist' now match those in `erc-networks-alist'.
508
509**** New variable `erc-nickserv-identify-mode' - Choose which method
510to use for automatic identification: you can wait for Nickserv to ask
511you to identify (the default), or send an identify message
512automatically after you change your nickname.
513
514*** Speedbar (erc-speedbar.el)
515
516**** New variable `erc-speedbar-sort-users-type' - Sort users in a
517channel by activity, alphabetically, or not at all.
518
519*** Timestamps (erc-stamp.el)
520
521**** `erc-timestamp-only-if-changed-flag' now works when
522`erc-insert-timestamp-function' is set to 'erc-insert-timestamp-left.
523
524**** New variable `erc-timestamp-intangible' - Set this to nil if
525timestamps should not have the 'intangible property.
526
527*** Channel tracking (erc-track.el)
528
529**** Using faces to indicate channel activity in the modeline now works
530in XEmacs.
531
532**** New variables
533
534 o `erc-track-priority-faces-only' - Ignore changes in a channel
535 unless there is a face from the `erc-track-faces-priority-list' in
536 the message.
537
538 o `erc-track-exclude-server-buffer' - Ignore changes in the server
539 buffer.
540
541 o `erc-track-position-in-mode-line' - Set the position in the
542 mode-line where modified channels are shown (only works in GNU
543 Emacs versions above 21.3).
544
545* Changes since ERC 3.0.cvs.20030119
546
547** The module system has again changed a lot. You can now customize
548 the variable `erc-modules' and define once and for all which
549 extension modules you want to use. This unfortunately may require
550 you to change your current erc initialisation code a bit, if you
551 have some existing customsations. On the other hand, this change
552 makes the configuration of extension modules a lot easier for new
553 users. In theory, you should be able to configure all aspects of
554 ERC by using the customize interface, you should no longer really
555 need to write Lisp code for trivial customizations.
556
557 By default, the following modules are now loaded: (pcomplete
558 netsplit fill track ring button autojoin)
559
560 Please use M-x customize-variable RET erc-modules RET to change the
561 default if it does not suite your needs.
562
563** THe symbol used in `erc-nickserv-passwords' for debian.org IRC servers
564 (formerly called OpenProjects, now FreeNode) has changed from
565 openprojects to freenode. You may need to update your configuration
566 for a successful automatic nickserv identification.
567
568* Changes since ERC 2.93.cvs.20020819
569
570** New module erc-dcc:
571
572This finally implements DCC. It requires server sockets to fully work
573in both directions. This feature is currently only available in Emacs
57421.3.50 (CVS). Here is a short list of what should work though.
575
576** Compatibility:
577 * Emacs 21.2, DCC get, and accepting DCC chat offers.
578 * XEmacs 21, Only accepting DCC chat offers.
579
580** erc is switching to global-minor-modes for activation of submodules.
581
582This allows you to customize such a mode and get automatic loading of
583the module. No longer putting a lot of require statments in .emacs.
584At least this is the long-term plan, not all modules are converted
585yet.
586
587** The most important user visible change is that you now need to activate
588erc-completion-mode, to get TAB completion. The new completion code
589is based on pcomplete. To get the old code, manually load
590erc-complete and bind TAB to erc-complete in erc-mode-map.
591
592To activate completion on startup, put (erc-completion-mode 1) in your
593.emacs file.
594
595Same applies to timestamps. You no longer need to (require
596'erc-stamp), you can customize the variable `erc-timestamp-mode', and
597the rest should be automatic.
598
599arch-tag: 2b21b387-6cdc-4192-889c-6743cfffdcb1
diff --git a/etc/NEWS b/etc/NEWS
index 4e5e0be403b..983dd5287e3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1504,6 +1504,17 @@ colors as on X.
1504 1504
1505* New Modes and Packages in Emacs 22.1 1505* New Modes and Packages in Emacs 22.1
1506 1506
1507** ERC is now part of the Emacs distribution.
1508
1509ERC is a powerful, modular, and extensible IRC client for Emacs.
1510
1511To see what modules are available, type
1512M-x customize-option erc-modules RET.
1513
1514To start an IRC session, type M-x erc-select, and follow the prompts
1515for server, port, and nick.
1516
1517---
1507** Rcirc is now part of the Emacs distribution. 1518** Rcirc is now part of the Emacs distribution.
1508 1519
1509Rcirc is an Internet relay chat (IRC) client. It supports 1520Rcirc is an Internet relay chat (IRC) client. It supports
diff --git a/info/dir b/info/dir
index 10309c8a884..035ed6e7319 100644
--- a/info/dir
+++ b/info/dir
@@ -41,6 +41,8 @@ Emacs
41* CC mode: (ccmode). Emacs mode for editing C, C++, Objective-C, 41* CC mode: (ccmode). Emacs mode for editing C, C++, Objective-C,
42 Java, Pike, and IDL code. 42 Java, Pike, and IDL code.
43* Ebrowse: (ebrowse). A C++ class browser for Emacs. 43* Ebrowse: (ebrowse). A C++ class browser for Emacs.
44* ERC: (erc). Powerful, modular, and extensible IRC client
45 for Emacs.
44* Flymake: (flymake). An on-the-fly syntax checker for Emacs. 46* Flymake: (flymake). An on-the-fly syntax checker for Emacs.
45* IDLWAVE: (idlwave). Major mode and shell for IDL and WAVE/CL files. 47* IDLWAVE: (idlwave). Major mode and shell for IDL and WAVE/CL files.
46 48
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
new file mode 100644
index 00000000000..b50ac5a0df2
--- /dev/null
+++ b/lisp/erc/ChangeLog
@@ -0,0 +1,327 @@
12006-01-28 Michael Olson <mwolson@gnu.org>
2
3 * erc-*.el, erc.texi, NEWS: Add Arch taglines as per Emacs
4 guidelines.
5
6 * erc-*.el: Space out copyright years like the rest of Emacs. Use
7 the Emacs copyright statement. Refer to ourselves as ERC rather
8 than "Emacs IRC Client", since there are now several IRC clients
9 for Emacs.
10
11 * erc-compat.el (erc-emacs-build-time): Define as a variable.
12
13 * erc-log.el (erc-log-setup-logging): Use write-file-functions.
14
15 * erc-ibuffer.el: Require 'erc.
16
17 * erc-stamp.el (erc-insert-aligned): Only use the special text
18 property when window-system is X.
19
20 * erc.texi: Adapt for inclusion in Emacs.
21
222006-01-28 Johan Bockgård <bojohan@users.sourceforge.net>
23
24 * erc.el (erc-format-message): More `cl' breakage; don't use
25 `oddp'.
26
272006-01-27 Michael Olson <mwolson@gnu.org>
28
29 * debian/changelog: Update for new release.
30
31 * debian/control (Description): Update.
32
33 * debian/rules: Concatenate ChangeLog for 2005.
34
35 * Makefile (MISC): Include ChangeLog.2005 and erc.texi.
36 (debrelease, release): Copy images directory.
37
38 * NEWS: Spelling fixes. Add items for recent changes.
39
40 * erc.el (erc): Move call to erc-update-modules before the call to
41 erc-mode. This should fix a timestamp display issue.
42 (erc-version-string): Release ERC 5.1.
43
442006-01-26 Michael Olson <mwolson@gnu.org>
45
46 * erc-stamp.el (erc-insert-aligned): New function that inserts
47 text in an perfectly-aligned way relative to the right margin. It
48 only works well with Emacs22. A sane fallback is provided for
49 other versions of Emacs.
50 (erc-insert-timestamp-right): Use the new function.
51
522006-01-25 Edward O'Connor <ted@oconnor.cx>
53
54 * erc.el (erc-modules): Ensure that `erc-button-mode' gets enabled
55 before `erc-match-mode'.
56
57 * erc-match.el (match): Append `erc-match-message' to
58 `erc-insert-modify-hook'.
59
602006-01-25 Michael Olson <mwolson@gnu.org>
61
62 * FOR-RELEASE: Mark last release requirement as done.
63
64 * Makefile (realclean, distclean): Remove docs.
65
66 * erc.texi: Take care of all pre-5.1 items.
67
68 * erc-backend.el (erc-server-send, erc-server-send-queue): Wrap
69 `process-send-string' in `condition-case' to avoid an error when
70 quitting ERC.
71
72 * erc-stamp.el (erc-insert-timestamp-right): Try to deal with
73 variable-width characters in the timestamp and on the same line.
74 The latter is a kludge, but it seems to work with most of the
75 input I've thrown at it so far. It's certainly better than going
76 past the end of line consistently when we have variable-width
77 characters on the same line. When `erc-timestamp-intangible' is
78 non-nil, add intangible properties to the whitespace as well, so
79 that hitting <end> does what you'd expect.
80
81 * erc.el (erc-flood-protect, erc-toggle-flood-control): Update
82 this to only use boolean values for `erc-flood-protect'. Update
83 documentation.
84 (erc-cmd-QUIT): Set the active buffer to be the server buffer, so
85 that any QUIT-related messages go there.
86 (erc): Try to be more clever about re-using channel buffers when
87 automatically re-connecting. Thanks to e1f for noticing.
88
892006-01-23 Michael Olson <mwolson@gnu.org>
90
91 * ChangeLog.2005: Remove erroneous line.
92
93 * FOR-RELEASE: Make that the Makefile tweaking is complete.
94 (NEWS): Mark as done.
95
96 * Makefile (MANUAL): New option indicating the name of the manual.
97 (PREFIX, ELISPDIR, INFODIR): New options that specify the
98 directories to install lisp code and info manuals to. PREFIX is
99 used only by ELISPDIR and INFODIR.
100 (all): Call `lisp' and create the manual.
101 (lisp): Compile lisp code.
102 (%.info, %.html): New rules that make Info files and HTML files,
103 respectively, from a TexInfo source.
104 (doc): Create both the Info and HTML versions of the manual. This
105 is for the user -- we never call it automatically.
106 (install-info): Install Info files.
107 (install-bin): Install compiled and source Lisp files.
108 (todo): Remove, since it seems pointless.
109
110 * NEWS: Update.
111
112 * README: Add Installation instructions. Tweak layout.
113
114 * erc.texi: Work on some pre-5.1 items.
115
116 * erc-stamp.el, erc-track.el: Move some functions and options in
117 order to get rid of a few compiler warnings.
118
119 * erc.el (erc-modules): Enable readonly by default. This will
120 prevent new users from accidentally removing old messages, which
121 could be disconcerting. Also enable stamp by default, since
122 timestamps are a fairly standard feature among IRC clients.
123
124 * erc-button.el: Munge whitespace.
125
126 * erc-identd.el (erc-identd-start): Instead of throwing an error,
127 just try to use the obsolete function.
128
1292006-01-22 Michael Olson <mwolson@gnu.org>
130
131 * erc-backend.el (erc-decode-string-from-target): Make sure that
132 we have a string as an argument. If not, coerce it to the empty
133 string. Hopefully, this will work painlessly around an edge case
134 related to quitting ERC around the same time a message comes in.
135
1362006-01-22 Johan Bockgård <bojohan@users.sourceforge.net>
137
138 * erc-track.el: Use `(eval-when-compile (require 'cl))' (for
139 `case'). Doc fixes.
140 (erc-find-parsed-property): Simplify.
141 (erc-track-get-active-buffer): Fix logic. Simplify.
142 (erc-track-switch-buffer): Remove unused variable `dir'. Simplify.
143
144 * erc-speak.el: Doc fixes.
145 (erc-speak-region): `propertize' --> `erc-propertize'.
146
147 * erc-dcc.el (erc-dcc-chat-parse-output): `propertize' -->
148 `erc-propertize'.
149
150 * erc-button.el (erc-button-add-button): Take erc-fill-prefix into
151 account when wrapping URLs.
152
153 * erc-bbdb.el (erc-bbdb-elide-display): Doc fix.
154
155 * erc-backend.el (define-erc-response-handler): Doc fix.
156
1572006-01-22 Michael Olson <mwolson@gnu.org>
158
159 * erc.el (erc-update-modules): Use `require' instead of `load',
160 but prevent it from causing errors, in order to preserve the
161 previous behavior.
162
1632006-01-21 Michael Olson <mwolson@gnu.org>
164
165 * FOR-RELEASE (Source): Mark cl task as done.
166
167 * Makefile (erc-auto.el): Call erc-generate-autoloads rather than
168 generate-autoloads.
169 (erc-auto.el, %.elc): Don't show command, just its output.
170
171 * NEWS: Add items from 2005-01-01 to 2005-08-13.
172
173 * debian/copyright (Copyright): Update.
174
175 * erc-auto.in (erc-generate-autoloads): Rename from
176 generate-autoloads.
177
178 * erc.el, erc-autoaway.el, erc-backend.el: Use
179 erc-server-process-alive instead of erc-process-alive.
180
181 * erc.el, erc-backend.el, erc-ezbounce.el, erc-list.el,
182 erc-log.el, erc-match.el, erc-nets.el, erc-netsplit.el,
183 erc-nicklist.el, erc-nickserv.el, erc-notify.el, erc-pcomplete.el:
184 Use (eval-when-compile 'cl), so that compilation doesn't fail.
185
186 * erc-fill.el, erc-truncate.el: Whitespace munging.
187
188 * erc.el: Update copyright notice. Remove eval-after-load code.
189 (erc-with-buffer): Docfix.
190 (erc-once-with-server-event, erc-once-with-server-event-global)
191 (erc-with-buffer, erc-with-all-buffers-of-server): Use erc-gensym
192 instead of gensym.
193 (erc-banlist-update): Use erc-delete-if instead of delete-if.
194 (erc): Call `erc-update-modules' here.
195
196 * erc-backend.el: Require 'erc-compat to minimize compiler
197 warnings.
198 (erc-decode-parsed-server-response): Docfix.
199 (erc-server-process-alive): Move here from erc.el and rename from
200 `erc-process-alive'.
201 (erc-server-send, erc-remove-channel-users): Make sure process is
202 alive before sending data to it.
203
204 * erc-bbdb.el: Update copyright years.
205 (erc-bbdb-whois): Remove overexuberant comment.
206
207 * erc-button.el: Require erc-fill, since we make liberal use of
208 `erc-fill-column'.
209
210 * erc-compat.el (erc-const-expr-p, erc-list*, erc-assert): New
211 functions, the latter of which provides an `assert' equivalent.
212 (erc-remove-if-not): New function that provides a simple
213 implementation of `remove-if-not'.
214 (erc-gensym): New function that provides a simple implementation
215 of `gensym'.
216 (erc-delete-if): New function that provides a simple
217 implementation of `delete-if'.
218 (erc-member-if): New function that provides a simple
219 implementation of `member-if'.
220 (field-end): Remove this, since it is unused, and later versions
221 of XEmacs have this function already.
222 (erc-function-arglist): Moved here from erc.el.
223 (erc-delete-dups): New compatibility function for dealing with
224 XEmacs.
225 (erc-subseq): New function copied from cl-extra.el.
226
227 * erc-dcc.el: Require pcomplete during compilation to avoid
228 compiler warnings.
229 (erc-unpack-int, erc-dcc-send-filter)
230 (erc-dcc-get-filter): Use erc-assert instead of assert.
231 (pcomplete/erc-mode/DCC): Use erc-remove-if-not instead of
232 remove-if-not.
233
234 * erc-match.el (erc-log-matches): Fix compiler warning.
235
236 * erc-nicklist.el: Update copyright notice.
237 (erc-nicklist-menu): Change use of caadr to (car (cadr ...)).
238 (erc-nicklist-bitlbee-connected-p): Remove.
239 (erc-nicklist-insert-medium-name-or-icon): Accept channel
240 argument. Use it to determine whether we are on bitlbee. Now
241 that bitlbee names its channel "&bitlbee", this is trivial.
242 (erc-nicklist-insert-contents): Pass channel as specified above.
243 Don't try to determine whether we are on bitlbee here.
244 (erc-nicklist-channel-users-info): Use erc-remove-if-not instead
245 of remove-if-not.
246 (erc-nicklist-search-for-nick): Use erc-member-if instead of
247 member-if.
248
249 * erc-notify.el (erc-notify-QUIT): Use erc-delete-if with a
250 partially-evaluated lambda expression instead of `delete' and
251 `find'.
252
253 * erc-track.el: Use erc-assert.
254 (erc-track-modified-channels): Remove use of `return'.
255 (erc-track-modified-channels): Use `cadr' instead of `second',
256 since otherwise we would need yet another eval-when-compile line.
257
2582006-01-19 Michael Olson <mwolson@gnu.org>
259
260 * erc-backend.el (erc-process-sentinel-1): Remove attempt to
261 detect SIGPIPE, since it doesn't work.
262
2632006-01-10 Diane Murray <disumu@x3y2z1.net>
264
265 * erc-spelling.el: Updated copyright years.
266 (define-erc-module): Enable/disable `flyspell-mode' for all open
267 ERC buffers as well.
268 (erc-spelling-dictionaries): Reworded customize description.
269
270 * erc.el (erc-command-symbol): New function.
271 (erc-extract-command-from-line): Use `erc-command-symbol'. This
272 fixes a bug where "Symbol's function definition is void:
273 erc-cmd-LIST" would be shown after typing /list at the prompt (the
274 command was interned because erc-menu.el uses it and is enabled by
275 default whereas erc-list.el is not).
276
277 * NEWS: Started a list of renamed variables.
278
279 * erc.el: Reworded the message sent when defining variable
280 aliases.
281 (erc-command-indicator-face): Doc fix.
282 (erc-modules): Enable the match module by default which makes
283 current nickname highlighting on as the default.
284
285 * erc-button.el: Updated copyright years.
286 (erc-button): New face.
287 (erc-button-face): Use `erc-button'.
288 (erc-button-nickname-face): New customizable variable.
289 (erc-button-add-nickname-buttons, erc-button-add-buttons-1): Send
290 new argument to `erc-button-add-button'.
291 (erc-button-add-button): Doc fix. Added new argument to function
292 definition, NICK-P. If it's a nickname, use
293 `erc-button-nickname-face', otherwise use `erc-button-face'. This
294 makes channel tracking and buttons work better together when
295 `erc-button-buttonize-nicks' is enabled, since there is a nickname
296 on just about every line.
297
298 * erc-track.el (erc-track-use-faces): Doc fix.
299 (erc-track-faces-priority-list): Added `erc-button' to list.
300 (erc-track-priority-faces-only): Doc fix.
301
3022006-01-09 Diane Murray <disumu@x3y2z1.net>
303
304 * erc-button.el (erc-button-url-regexp): Use `concat' so the
305 regexp is not one long line.
306 (erc-button-alist): Fixed so that customizing works correctly.
307 Reorganized. Removed lambda functions with more than two lines.
308 Doc fix.
309 (erc-button-describe-symbol, erc-button-beats-to-time): New
310 functions. Moved from `erc-button-alist'.
311
3122006-01-07 Michael Olson <mwolson@gnu.org>
313
314 * erc-backend.el (erc-process-sentinel-1): Don't try to re-open a
315 process if a SIGPIPE occurs. This happens when a new message
316 comes in at the same time a /quit is requested.
317 (erc-process-sentinel): Use string-match rather than string= to do
318 these comparisons. Matching literal newlines makes me nervous.
319
320 * erc-track.el (erc-track-remove-from-mode-line): Handle case
321 where global-mode-string is not a list. Emacs22 permits this.
322
323 Copyright (C) 2006 Free Software Foundation, Inc.
324 Copying and distribution of this file, with or without modification,
325 are permitted provided the copyright notice and this notice are preserved.
326
327;; arch-tag: 865a75f6-2bcb-46df-bf0c-b514dadf688a
diff --git a/lisp/erc/ChangeLog.2001 b/lisp/erc/ChangeLog.2001
new file mode 100644
index 00000000000..52a209be61b
--- /dev/null
+++ b/lisp/erc/ChangeLog.2001
@@ -0,0 +1,1042 @@
12001-12-18 Mario Lang <mlang@delysid.org>
2
3 * erc.el: * Added missing 747 numreply (banned)
4
52001-12-15 Gergely Nagy <algernon@debian.org>
6
7 * debian/scripts/install, debian/rules:
8 updated to 2.1.cvs.20011215-1
9
10 * debian/changelog: Debian version 2.1.cvs.20011215-1
11
122001-12-11 Andreas Fuchs <asf@void.at>
13
14 * erc.el:
15 * applied a nicer version of mhp's patch to remove the last prompt from
16 saved logs
17
18 * erc-replace.el: * Initial checkin
19
202001-12-11 Mario Lang <mlang@delysid.org>
21
22 * erc.el:
23 * fixed bug triggered when reuse-buffer was enabled (the default).
24 Another silly port type problem. Maybe we should unify that once and for all sometimes...
25
262001-12-10 Mario Lang <mlang@delysid.org>
27
28 * erc.el: * erc-message-english: New QUIT and s004 entries.
29 * erc-save-buffer-on-part: New variable.
30 * erc-kill-buffer-on-part: New variable.
31 * (erc-server-PART): Use above variables.
32 * (erc-join-channel): Use DEF argument instead of initial input for completing-read.
33
342001-12-08 Tijs van Bakel <smoke@wanadoo.nl>
35
36 * erc.el: added defcustom erc-nick-uniquifier ^ (i prefer _)
37
382001-12-07 Gergely Nagy <algernon@debian.org>
39
40 * debian/changelog: changelog for version 2.1.cvs.20011208-1
41
422001-12-07 Tijs van Bakel <smoke@wanadoo.nl>
43
44 * erc.el:
45 Added erc-scroll-to-bottom as an erc-insert-hook function. It still bugs a bit, so please test it, thanks
46
472001-12-07 Mario Lang <mlang@delysid.org>
48
49 * erc.el: * Fixed silly bug in erc-server-TOPIC (thanks mhp)
50
51 * erc-speak.el:
52 * Fix non-greedy matching bug. That one somehow swallowed text
53
54 * erc.el:
55 Fix Emacs20 problem. For now, we disable erc-track-modified-channels-minor-mode in emacs20
56
572001-12-07 Andreas Fuchs <asf@void.at>
58
59 * erc-fill.el:
60 * Fix another stupid one-off error. This time it really works!
61 (Until I find the next bug. I guess you can hold your breath) (-:
62
632001-12-06 Andreas Fuchs <asf@void.at>
64
65 * erc-fill.el: * Fixed static filling:
66 ** No more \ed (continued on next line) lines anymore
67 ** Fixed bug with previous version where longer lines wouldn't get
68 filled correctly (i.e. at all)
69
702001-12-06 Gergely Nagy <algernon@debian.org>
71
72 * debian/changelog: changelog for 2.1.cvs.20011206-1 added
73
742001-12-06 Andreas Fuchs <asf@void.at>
75
76 * erc.el:
77 * Don't discard away status when identifying to NickServ
78 * Modify `erc-already-logged-in': check for port, too.
79
80 * erc-fill.el:
81 * Fix stupid loop non-termination error in erc-fill-static when filling
82 one-line regions.
83 * Make erc-count-lines return meaningful values
84
852001-12-05 Mario Lang <mlang@delysid.org>
86
87 * erc.el:
88 * (erc-process-input): Make ' /command' work for quoting /commands
89
90 * erc-speak.el: see changelog
91
92 * erc-fill.el: see erc.el changelog
93
94 * erc.el:
95 * erc-insert-hook: Changed strategy completely, no start end parameters any more.
96 We narrow-to-region now, thats much cleaner.
97 * rename erc-fill-region to erc-fill and change the autoload
98 ** You'll probably need to restart Emacs
99
1002001-12-04 Mario Lang <mlang@delysid.org>
101
102 * erc.el:
103 * (erc-send-current-line): Fixed long outstanding bug. XEmacs users with erc-fill-region on erc-insert-hook knew that one a long time.
104
105 * erc.el: fix order of attack
106
107 * erc.el: * macroexpanded define-minor-mode for XEmacs
108
109 * erc.el: First try to make channel tracking mouse sensitive
110
111 * erc.el: * More erc-message-format conversion.
112 erc-format-message-english-PART as an example on how to use functions to format message
113 * (erc-format-message): Fallback mechanism to use english catalog if variable is not bound
114
1152001-12-03 Mario Lang <mlang@delysid.org>
116
117 * erc.el: * (erc-iswitchb): Rewrite, docfix.
118 Make it use erc-modified-channels as default if available.
119
120 * erc-menu.el:
121 * Fixage related to erc-track-modified-channels-minor-mode rewrite
122
123 * erc.el:
124 * erc-track-modified-channels-minor-mode: Use buffer objects instead of erc-default-target return value for internal state keeping.
125
126 * erc.el: * Made reconnect behave nicer (erc-process-sentinel)
127 * Rewrote erc-modified-channels-tracking completely.
128 Its now a minor mode (erc-track-modified-channels-minor-mode)
129 It uses a list as internal representation now, so all silly string-parsing
130 related bugs should be gone.
131 Use (erc-track-modified-channels-minor-mode t) now to toggle this functionality.
132 Dont set the erc-track-modified-channels-minor-mode variable yourself, use the toggle function
133
1342001-11-29 Gergely Nagy <algernon@debian.org>
135
136 * debian/changelog: final version
137
1382001-11-29 Mario Lang <mlang@delysid.org>
139
140 * erc.el:
141 * (erc-channel-p): Make it work with string and buffer as parameter. buffer.
142 * (erc-format-message): Add a check for functionp. This allows a format-specifier also to be a function name, which gets called with args applied and needs to return the actual format string.
143 * Converted some formats, JOIN, JOIN-you, MODE, ...
144
1452001-11-28 Mario Lang <mlang@delysid.org>
146
147 * erc.el:
148 * (erc-prepare-mode-line-format): Added sanity checks to prevent it from having problems with server buffers where the connection failed
149
150 * erc-bbdb.el:
151 * (erc-bbdb-JOIN): regexp-quote the fingerhost before searching, some people have really strange characters as their user names
152
153 * erc.el: Remove a stupid debug like (message ...) call
154
1552001-11-28 Gergely Nagy <algernon@debian.org>
156
157 * debian/changelog: draft of 2.1.cvs.20011128-1
158
159 * debian/rules: simplify for the all-in-one erc package
160
161 * debian/control: integrated erc-speak back into erc
162
163 * debian/maint/conffiles, debian/maint/conffiles.in, debian/maint/postinst,
164 debian/maint/postinst.in, debian/maint/prerm, debian/maint/prerm.in,
165 debian/scripts/install, debian/scripts/install.in, debian/scripts/remove,
166 debian/scripts/remove.in, debian/scripts/startup.erc-speak:
167 since erc-speak is gone, resurrect the static files, and update them to support the latest erc
168
1692001-11-28 Mario Lang <mlang@delysid.org>
170
171 * erc.el: * (erc-mode): Shouldn't be interactive.
172 * (erc-info-mode): Ditto.
173
174 * erc.el: * (erc-server-352): Added hopcount parsing.
175 Added call to erc-update-channel-member to fill in channel-members information
176 on /WHO if the channel is joined.
177
1782001-11-27 Mario Lang <mlang@delysid.org>
179
180 * erc-speedbar.el: *** empty log message ***
181
182 * erc-speedbar.el: * (erc-speedbar-expand-user): New function.
183 Used when more information than just the nick name is available about a dude.
184
185 * erc.el: * Fixed stupid edit,checkin,save cycle error :)
186
187 * erc.el:
188 * (erc-generate-log-file-name-default): Renamed to -long
189 Doc fix.
190 * (erc-generate-log-file-name-old): Renamed to -long
191 Doc fix.
192 * erc-generate-log-file-name-function: Set default to ...-long
193 Doc fixes
194
195 * erc-speedbar.el: *** empty log message ***
196
1972001-11-26 Mario Lang <mlang@delysid.org>
198
199 * erc-speedbar.el: * Integrated channel names list
200 what else do we need to replace info buffers???
201 please test that code and comment on erc-ehlp, thanks
202
203 * erc-speedbar.el:
204 * Added erc-speedbar-goto-buffer and therefore enable switching to the buffers from speedbar
205
206 * erc-speedbar.el:
207 I had to check this in, it works !! sort of,, megaalphagammaversion, first version. test, play, submit ideas/patches
208
2092001-11-26 Gergely Nagy <algernon@debian.org>
210
211 * erc.el(erc-mode): moved erc-last-saved-position here
212 moved buffer naming code from here..
213 (erc): ...to here
214 (erc-generate-log-file-name-old): only prepend target if it exists
215
216 made erc-log-insert-log-on-open a defcustom
217
2182001-11-26 Mario Lang <mlang@delysid.org>
219
220 * erc.el:
221 * Applied antifuchs/mhp patches, the latest on erc-help, unmodified
222 * New variable: erc-reuse-buffers default to t.
223 * Modified erc-generate-new-buffer-name to use it. it checks if server and port are the same,
224 then one can assume thats the same channel/query target again.
225
2262001-11-23 Mario Lang <mlang@delysid.org>
227
228 * erc-bbdb.el:
229 * new function erc-BBDB-NICK to handle nickname anotation on a nick-change event of a known record
230
231 * erc.el: * Remove erc-rename-buffer, its no longer necessary
232 * Remove erc-autoop-*. it was broken, and needed rewrite anyway
233 * write erc-already-logged-in in terms of erc-buffer-list and make the duplicate login check work again
234
235 * erc.el: * Fixed stupid typo
236
2372001-11-22 Mario Lang <mlang@delysid.org>
238
239 * erc.el: * New local variable, erc-announced-server-name
240 * erc-mode-line-format supports a new symbol, target-and/or-server
241 * The mode-line displays the announced server name now (for autojoin later...,
242 greets Adam)
243 * New macro, erc-server-hook-list for a nice way to define the defcustoms of the erc-server-*-hook's
244 Thanks go to the guy from #emacs who helped with that
245 * erc-fill-region is now autoloaded from erc-fill.el
246 * erc-fill.el implements a new fill method, erc-fill-static
247 (setq erc-fill-function 'erc-fill-static)
248 * Some other things I forgot right now
249
250 * erc-bbdb.el: *** empty log message ***
251
252 * erc-fill.el: Initial version.
253
254 * erc-complete.el:
255 Applied antifuchs patch to make completion work with (string= erc-prompt "")
256
257 * erc-complete.el:
258 added function erc-nick-completion-exclude-myself
259 you can set erc-nick-completion to 'erc-nick-completion-exclude-myself to use it
260
2612001-11-21 Mario Lang <mlang@delysid.org>
262
263 * erc-bbdb.el:
264 * Changed usage of 'finger-host to bbdb-finger-host-field
265
266 * erc-bbdb.el:
267 * Changed WHOIS to use finger-host instead of net field.
268 * Added 'visible as option to erc-bbdb-popup-p to only pop-up the bbdb buffer if a join happened in a visible buffer on any visible frame.
269 * Added (regexp-quote ...) for nickname search in erc-bbdb-JOIN
270
2712001-11-20 Mario Lang <mlang@delysid.org>
272
273 * erc-bbdb.el: * Added JOIN support
274
2752001-11-19 Mario Lang <mlang@delysid.org>
276
277 * erc.el:
278 Initial message catalog code. converted erc-action-format usage to use it
279
280 * erc.el: * erc-play-sound: Added XEmacs related check
281
282 * erc-bbdb.el: * Initial version, many thanks to Andreas Fuchs
283
284 * erc.el: * Fixed silly problem with whois/was handling
285
286 * erc.el: * Renamed prev-rd to erc-previous-read
287 * Removed erc-next-line-add-newlines and s next-line-add-newlines to nil in defun erc by default
288
289 * erc.el:
290 fixed xemacs compatibility prob with delete, thanks Adam
291
2922001-11-18 Mario Lang <mlang@delysid.org>
293
294 * erc.el: numreplies 301 & 461
295
2962001-11-13 Tijs van Bakel <smoke@wanadoo.nl>
297
298 * erc.el:
299 Added code for error reply 421 "Unknown command", to test the new server parsing system.
300 This was really easy! Thanks ZenIRC guys & delysid :-)
301
3022001-11-13 Mario Lang <mlang@delysid.org>
303
304 * erc.el: * Allow connecting to SSL enabled irc servers.
305 Ugly hack, but it works for now. Be sure to use the numeric irc port 994 so that erc can recognize what you want
306 good example is
307 irc server: ircs.segfault.net
308 port: 994
309
310 meet me there, I am still delYsid :)
311
312 * erc.el: * some more numreply handlers
313 * cleanup in erc-process-away-p
314 * new function erc-display-error-notice
315
316 * erc.el: * numreply 501 and 221
317
318 * erc.el:
319 removed obsolete old hook variables. Your functions may break, but it is easy to hook them up to the new hooks.
320 erc-part-hook: use erc-server-PART-hook instead
321 erc-kick-hook: use erc-server-KICK-hook instead
322 and so on
323
324 * erc.el:
325 fixed serious bug which cause privmsgs vanishing when erc-auto-query was set to nil
326
327 * erc.el: cleaned up erc-process-filter
328
329 * erc.el: * 401 and 320 numreplies implemented
330
331 * erc.el: * Removed old/now obsolete code
332
333 * erc.el: * Fixed bug in erc-server-MODE
334
3352001-11-12 Mario Lang <mlang@delysid.org>
336
337 * erc.el: fixed it
338
339 * erc.el:
340 *** We switched over. New server message parsing/handling is running now. Thansk to the zenirc developers for the great ideas I got from the code!!!!! Go and test it, poke at it, bug me on irc about problems
341
342 * erc.el: *** empty log message ***
343
3442001-11-12 Tijs van Bakel <smoke@wanadoo.nl>
345
346 * erc.el:
347 Fixed bug in erc-get-buffer, now channel names are compared in
348 a case-insensitive way.
349
3502001-11-12 Mario Lang <mlang@delysid.org>
351
352 * erc.el: erc-server-353
353
3542001-11-12 Tijs van Bakel <smoke@wanadoo.nl>
355
356 * erc.el: Fixed docstring for erc-get-buffer.
357 Added erc-process to a lot of calls to erc-get-buffer, so
358 that only the local process is searched.
359
3602001-11-12 Mario Lang <mlang@delysid.org>
361
362 * erc.el: * erc-buffer-filter: do it differently
363
364 * erc.el: ugly but working fix for mhp's query problem
365
366 * erc.el: * erc-server-PRIVMSG-or-NOTICE
367 Now, all the server word replies are finished. Going to numreplies now
368
369 * erc.el:
370 * debugging fascilities for the transition. C-x 2 C-x o M-x ielm RET erc-server-vectors RET ; to get a list of all server messages currently not handled in the new code. Feel free to pick one and implement it
371
372 * erc.el: * erc-server-KICK and erc-server-TOPIC. new functions
373 * erc-server-305-or-306 and erc-server-311-or-314
374
375 * erc.el:
376 * ported PART and QUIT msgs to the new scheme, many to go. but it is a easy task. does someone wanna try and start with numreplies?
377
378 * erc.el: * erc-server-JOIN
379
380 * erc.el: * Ported erc-server-INVITE code
381
382 * erc.el: * erc-server-ERROR and erc-server-MODE
383
3842001-11-11 Mario Lang <mlang@delysid.org>
385
386 * erc.el: * zen
387
388 * erc.el: * New variable erc-connect-function.
389
390 * erc.el:
391 * New function erc-channel-p and use it where appropriate
392
393 * erc.el: * Removed the variable erc-buffer-list completely now
394 * Moved erc-dbuf around a bit
395
396 * erc.el: * Fix silly change in quit/rename msg handling
397
398 * erc.el: thanks mhp, fixed
399
400 * erc.el: * Tijs van Bakel's work from 10th Nov. merged in
401 * My additions to that idea merged in too
402 Basicly, this is a major rewrite, if you are scared and want avoid problems,
403 stay at your current version. It seems fairly stable though.
404 That changed? erc-buffer-name handling was completely rewritten,
405 and erc-buffer-list local variable handling removed.
406 Simplifies alot of code. Poke at it. read the diff. report bug/send patches!
407
408 * erc.el: * Added variable listing when /set is used without args
409
4102001-11-10 Mario Lang <mlang@delysid.org>
411
412 * erc.el:
413 * Comment/structure cleanup, removal of unnecessary code
414
415 * erc.el: only some code beautification
416
417 * erc-imenu.el:
418 remove add-hook call, thats done in erc.el now for autoloadability
419
420 * erc.el: * Make erc-imenu autoloadable
421
422 * erc.el:
423 * The long promised erc-mode-line-format handling rewrite
424 Poke at it, try it, play with it, report bugs
425
426 * erc.el:
427 some regex-quote fixes, new function erc-cmd-set, and minor things
428
4292001-11-08 Mario Lang <mlang@delysid.org>
430
431 * erc.el:
432 * added second timestamp-format (erc-away-timestamp-format) for marking msgs when being away
433
434 * erc-complete.el: fixed silly deffun
435
436 * erc.el: * Rewrote erc-load-irc-script (simplified)
437 * Removed depricated code
438
439 * erc-speak.el: * reflect changes in erc.el
440
441 * erc.el:
442 * Moved completion related functions into erc-complete.el
443 placed an autoload instead into erc.el. That quite cool,
444 because erc-complete.el only gets loaded when you use
445 TAB first time in erc.
446
447 * erc-complete.el: _ Initial checkin
448
449 * erc.el: * New function: erc-chain-hook-with-args
450 * Changed calls to erc-insert-hook to use it
451
4522001-11-07 Mario Lang <mlang@delysid.org>
453
454 * erc.el: * Patch from Fabien Penso
455 Make completion case insensitive. try it! its cool
456
457 * erc.el: * Reduction patch 2
458 This time, we move the input ring handling into erc-ring.el
459 Remember that you need (require 'erc-ring) in your .emacs to get the input handling as a feature
460 And remeber, that you dont need it if you dont use input ring :-)
461
462 * erc-ring.el: * Initial checkin
463
464 * erc.el: * The great reduction patch :-)
465 moved relevant function from erc.el to new file erc-menu.el and erc-imenu.el
466
467 * erc-imenu.el: nitial version
468
469 * erc-menu.el: * Initial version
470
471 * erc.el: * wording change suggested by Benjamin Drieu
472
4732001-11-07 Tijs van Bakel <smoke@wanadoo.nl>
474
475 * erc.el: Added Emacs version to /SV
476
4772001-11-07 Mario Lang <mlang@delysid.org>
478
479 * erc.el: * Hookification patch, read the diff
480
481 * erc.el: too tired for a changelog :)
482
4832001-11-06 Mario Lang <mlang@delysid.org>
484
485 * erc.el:
486 * make erc-cmd-op and erc-cmd-deop take multiple nicknames as argument
487
4882001-11-06 Gergely Nagy <algernon@debian.org>
489
490 * debian/changelog: sync
491
492 * debian/rules: fixed a typo: PKGDIR, not PKIDR
493
4942001-11-06 Mario Lang <mlang@delysid.org>
495
496 * erc.el:
497 * Changed timestamping when away to use erc-timestamp-format and append the timestamp instead of prepending it..
498 * minor cleanup, s/(if (not /(unless/ and thelike
499
5002001-11-06 Tijs van Bakel <smoke@wanadoo.nl>
501
502 * erc.el: Fixed OP and DEOP commands to return T.
503 Added SV say-version command.
504 Added erc-send-message utility function, but it's not used everywhere yet.
505
5062001-11-05 Mario Lang <mlang@delysid.org>
507
508 * erc.el: stupid delYsid, forgot require 'format-spec. good nite
509
510 * erc.el:
511 * new variable erc-action-format. Some erc-notice-prefix fixes again
512
513 * erc.el: * erc-minibuffer-privmsg defaults to t
514
515 * erc.el:
516 * Small fix in relation to the transition to erc-make-notice
517
5182001-11-05 Tijs van Bakel <smoke@wanadoo.nl>
519
520 * erc.el:
521 Renamed erc-message-notices to erc-minibuffer-notice, and renamed erc-prevent-minibuffer-privmsg to erc-minibuffer-privmsg, inverting its functionality
522
523 * erc.el: Added support for channel names starting with & + and !.
524 Also, many changes partially discussed on the mailinglist:
525
526 * erc.el (cl): Add requirement for cl package.
527 (erc-buffer-list): Make this variable global again.
528 (erc-default-face): Fix typo.
529 (erc-timestamp-face): Add face for timestamps.
530 (erc-join-buffer, erc): Add a 'bury option.
531 (erc-send-action): Add timestamp.
532 (erc-command-table): Add /CLEAR, /DEOP, /OP, /Q.
533 (erc-send-current-line): Add timestamp.
534 (erc-send-current-line): Add call to erc-insert-hook.
535 (erc-cmd-clear): New command to clear buffer contents.
536 (erc-cmd-whois): Fix cut'n'paste-o.
537 (erc-cmd-deop): New command to deop a user.
538 (erc-cmd-op): New command to op a user.
539 (erc-make-notice): Moved a lot of duplicate code here. Perhaps
540 this should also be done for erc-highlight-error.
541 (erc-parse-line-from-server): Now NOTICE will also open a new
542 query, just as PRIVMSG.
543 (erc-parse-line-from-server): Call erc-put-text-property on a
544 channel message/notice first, before concatenating nick and
545 timestamp &c.
546 (erc-message-notices): Add option to display notices in
547 minibuffer.
548 (erc-fill-region): No longer strip spaces in front of incoming
549 messages.
550 (erc-parse-current-line): No longer strip spaces in front of text
551 input by user.
552
553 Hopefully I didn't break too much :(
554
5552001-11-05 Mario Lang <mlang@delysid.org>
556
557 * erc.el:
558 * New function erc-nickserv-identify-autodetect for erc-insert-hook. Added by default currently.
559
560 * erc.el:
561 * Mini-fix in erc-process-num-reply (= n 353): Added @ as prefix character to make certain channels on opn work again nicely
562
5632001-10-31 Gergely Nagy <algernon@debian.org>
564
565 * debian/changelog: updated to reflect changes
566
567 * debian/scripts/install.in:
568 moved #PKGFLAG# before -f batch-byte-compile
569
5702001-10-29 Mario Lang <mlang@delysid.org>
571
572 * erc.el:
573 Imenu fixed somehow, added IRC services interactive function for indentify to NickServ. Read the diff
574
5752001-10-26 Gergely Nagy <algernon@debian.org>
576
577 * debian/changelog: sigh. -2
578
5792001-10-25 Gergely Nagy <algernon@debian.org>
580
581 * debian/changelog: updated to reflect changes
582
583 * debian/rules: handle conffiles.in too
584
585 * debian/maint/conffiles.in: new file
586
587 * debian/maint/conffiles: superceded by conffiles.in
588
589 * debian/scripts/startup: superceded by startup.erc
590
5912001-10-25 Mario Lang <mlang@delysid.org>
592
593 * debian/scripts/startup.erc-speak: * Initial version
594
595 * debian/scripts/startup.erc: * Added and fixes minimal typo
596
5972001-10-25 Gergely Nagy <algernon@debian.org>
598
599 * debian/changelog: updated to reflect changes
600
601 * debian/rules:
602 modified to be able to build the erc-speak package too
603
604 * debian/control: added the new erc-speak package
605
606 * debian/README.erc-speak, debian/maint/postinst.in, debian/maint/prerm.in,
607 debian/scripts/install.in, debian/scripts/remove.in:
608 new file
609
610 * debian/maint/postinst, debian/maint/prerm, debian/scripts/install,
611 debian/scripts/remove:
612 removed, superceded by it's .in counterpart
613
6142001-10-25 Mario Lang <mlang@delysid.org>
615
616 * erc.el: * Fixed some defcustom :type 's
617 * Added erc-before-connect hook which gets called with server port and nick.
618 Use this hook to e.g. setup a tunnel before actually connecting.
619 something like (when (string= server "localhost") ...)
620
6212001-10-24 Mario Lang <mlang@delysid.org>
622
623 * erc.el: * Patch by smoke: fix erc-cmd-* commands and add aliases
624
6252001-10-23 Mario Lang <mlang@delysid.org>
626
627 * erc-speak.el:
628 * Added a new personality for channel name announcement, This makes streams of flooded channels much easier to listen to,
629 especially if you are on more than one channel simultaniously.
630
631 * erc.el:
632 * Made the completion postfix customizable through erc-nick-completion-postfix
633
634 * erc-speak.el, erc.el:
635 * Added erc-prevent-minibuffer-privmsg
636
637 * erc-speak.el:
638 * Quickish hack to allow exclusion of timestamps from speaking. see erc-speak-filter-timestamps
639
6402001-10-21 Mario Lang <mlang@delysid.org>
641
642 * erc-speak.el:
643 * Removed now really obsolete code. Package size reduced by 50%
644
645 * erc-speak.el:
646 * Very important fix! Now erc-speak is really complete. Messages dont get cut anymore. Be sure to use auditory icons,
647 it's reallllly cool now!!!
648
649 * erc-speak.el: *** empty log message ***
650
651 * erc-speak.el: * Major simplification. depends on my 2001-10-21 changes to erc.el.
652 * Things removed, read diff
653
6542001-10-21 Gergely Nagy <algernon@debian.org>
655
656 * debian/changelog: oops, silly typo
657
658 * debian/changelog, debian/control, debian/copyright,
659 debian/maint/conffiles, debian/maint/postinst, debian/maint/prerm,
660 debian/rules, debian/scripts/install, debian/scripts/remove,
661 debian/scripts/startup:
662 initial check-in
663
6642001-10-21 Mario Lang <mlang@delysid.org>
665
666 * erc.el:
667 * Changed erc-insert-hook to get two arguments, START and END of the region
668 which got inserted. CAREFUL! This could break stuff, but it makes the hook
669 much more useable.
670
671 * erc.el:
672 * Made erc-smiley a new option, currently set to t to showoff this feature. :)
673
6742001-10-20 Mario Lang <mlang@delysid.org>
675
676 * erc.el: * Add missing erc-mode-hook variable
677 * Add smiley-support (preliminary test)
678
6792001-10-20 Alex Schroeder <alex@gnu.org>
680
681 * erc.el:
682 Replaced all occurences of put-text-property with a call to
683 erc-put-text-property.
684 (erc-put-text-property): New function.
685 (erc-tracking-modified-channels): Moved to the front of the file such
686 that it is already defined when the menu is being defined.
687 (erc-modified-channel-string): Ditto.
688
6892001-10-18 Alex Schroeder <alex@gnu.org>
690
691 * erc.el: Removed some commentary. The wiki page is the place to
692 put such information.
693 (erc-fill-prefix): Doc change.
694 (erc-notice-highlight-type): Doc change, now a user option.
695 (erc-pal-highlight-type): Doc change, now a user option.
696 (erc-fool-highlight-type): New option.
697 (erc-keyword-highlight-type): New option.
698 (erc-dangerous-host-highlight-type): New option.
699 (erc-uncontrol-input-line): Doc change.
700 (erc-interpret-controls-p): Doc change, now a user option.
701 (erc-multiline-input): Doc change.
702 (erc-auto-discard-away): Doc change.
703 (erc-pals): Changed from string to regexp.
704 (erc-fools): New option.
705 (erc-keywords): Renamed from erc-highlight-strings. WATCH OUT:
706 Not backwards compatible change!
707 (erc-dangerous-hosts): Renamed from erc-host-danger-highlight.
708 WATCH OUT: Not backwards compatible change!
709 (erc-menu-definition): Added menu entries for fools, keywords and
710 dangerous hosts.
711 (erc-mode-map): Changed keybindings from C-c <plain ascii> to
712 various C-c <C-ascii> combinations.
713 (erc-dangerous-host-face): Renamed from erc-host-danger-face.
714 WATCH OUT: Not backwards compatible change!
715 (erc-fool-face): New face.
716 (erc-keyword-face): Renamed from erc-highlight-face. WATCH OUT:
717 Not backwards compatible change!
718 (erc-parse-line-from-server): Fixed highlighting in the cases
719 where (equal erc-pal-highlight-type 'all), added code to handle
720 erc-fool-highlight-type, erc-dangerous-host-highlight-type
721 (erc-update-modes): Replaced erc-delete-string with delete.
722 (erc-keywords): Renamed from erc-highlight-strings, handle
723 erc-keyword-highlight-type.
724 (erc-delete-string): Removed.
725 (erc-list-match): New function.
726 (erc-pal-p): Use erc-list-match.
727 (erc-fool-p): New function.
728 (erc-keyword-p): New function.
729 (erc-dangerous-host-p): Renamed from erc-host-danger-p, use
730 erc-list-match.
731 (erc-directed-at-fool-p): New function.
732 (erc-add-entry-to-list): New function.
733 (erc-remove-entry-from-list): New function.
734 (erc-add-pal): Use erc-add-entry-to-list.
735 (erc-delete-pal): Use erc-remove-entry-from-list.
736 (erc-add-fool): New function.
737 (erc-delete-fool): New function.
738 (erc-add-keyword): New function.
739 (erc-delete-keyword): New function.
740 (erc-add-dangerous-host): New function.
741 (erc-delete-dangerous-host): New function.
742
7432001-10-07 Mario Lang <mlang@delysid.org>
744
745 * erc.el: * irc vs ircd default port fixed
746
747 * erc.el: * Added topic-change to imenu
748
749 * erc.el: * More imenu spiffyness
750
751 * erc.el: * Added imenu support
752
753 * erc.el:
754 * Fix to /topic to show topic instead of setting it to null :)
755
7562001-10-05 Mario Lang <mlang@delysid.org>
757
758 * erc.el: * First version of erc-rename-buffer
759
760 * erc.el: * more header-line tricks.
761
762 * erc.el:
763 * Small fix to do erc-update-mode-line-buffer in erc-update-channel-topic
764
765 * erc.el: * Added erc-header-line-format
766
7672001-10-04 Mario Lang <mlang@delysid.org>
768
769 * erc.el: * mini-fix, add msgp to auto-query code
770
771 * erc.el: * Added command-names to completion (erc-command-table)
772 * New variable erc-auto-query. When set, every arriving message to you
773 will open a query buffer for that sender if not already open.
774 * Compatibility function fo non-existing line-beginning|end-position functions in XEmacs.
775
7762001-10-03 Mario Lang <mlang@delysid.org>
777
778 * erc.el:
779 * Removed alot of (progn ...) where they were not necessary
780 * Changed some (if ...) without else part to (when ...)
781 * Some (while ...) to use (dolist ...)
782 * Fix for completion popup generating tracebacks.
783 * New function erc-arrange-session-in-mulptiple-windows
784 * Lots of other stuff, read the diff
785
7862001-10-02 Mario Lang <mlang@delysid.org>
787
788 * erc.el: * Added erc-kill-input and keybinding C-c C-u for it
789
7902001-10-01 Mario Lang <mlang@delysid.org>
791
792 * erc.el: * Another fix to nick-completion
793 * Additional checks in erc-track-modified-channels
794
7952001-09-26 Mario Lang <mlang@delysid.org>
796
797 * erc.el: * Fixed completion (alex)
798 * Now popup buffer doesnt destroy your window configuration.
799 * Fixed away handling (incomplete)
800
8012001-09-24 Mario Lang <mlang@delysid.org>
802
803 * erc.el: Fixed silly quoting-escape error
804
8052001-09-23 Mario Lang <mlang@delysid.org>
806
807 * erc.el: * Added auto-op support (unfinished)
808 * Added erc-latest-version.
809 * Added erc-ediff-latest-version.
810
8112001-09-21 Mario Lang <mlang@delysid.org>
812
813 * erc.el:
814 * Minor menu additions (invite only mode is now a checkbox)
815
8162001-09-20 Mario Lang <mlang@delysid.org>
817
818 * erc.el:
819 * Fix (erc-cmd-names): This should fix C-c C-n too, hoepfully it was the right fix and doesnt break anything else.
820
821 * erc.el: * Fixes XEmacs easymenu usage (2nd time).
822
8232001-09-19 Mario Lang <mlang@delysid.org>
824
825 * erc.el:
826 * (erc-complete-nick): Add ": " only if one completes directly after the erc-prompt, otherwise, add just one space
827
828 * erc.el:
829 * Changed menu-definition to use easymenu (hopefully this now works under Xemacs)
830 * Fix for custom problem with :must-match on XEmacs (thanks shapr)
831 * Added /COUNTRY command using (what-domain) from package mail-extr (shapr)
832 * Fix for case-sensitivity problem with pals (they are now all downcased)
833 * Different (erc-version) function which now can take prefix argument to insert the version information into the current buffer,
834 instead of just displaying it in the minibuffer.
835
8362001-09-10 Mario Lang <mlang@delysid.org>
837
838 * erc.el: Updated erc-version-string
839
840 * erc.el: Version number change and last read-through...
841
8422001-09-04 Mario Lang <mlang@delysid.org>
843
844 * erc.el: Added some asterisks
845
8462001-08-24 Mario Lang <mlang@delysid.org>
847
848 * erc.el:
849 Fixed hidden channel buffer tracking (sort of), now using switch-to-buffer for advice.
850 This version is unofficially named 2.1prebeta1. Please test it and send
851 fixes to various problems you may encounter so that we can eventually
852 release 2.1 soon.
853
8542001-08-14 Mario Lang <mlang@delysid.org>
855
856 * erc.el:
857 Added function erc-bol and keybinding C-c C-a for it (contributed by Benjamin Rutt <brutt@bloomington.in.us)
858
8592001-08-07 Mario Lang <mlang@delysid.org>
860
861 * erc.el:
862 Checked in lathis code and modified it slightly. Still unsure about set-window-buffer advice, current attempt doesnt seem to work.
863 Removed (nick -> #channel) from mode-line. (CLOSED) and (AWAY...) should still be displayed when appropriate
864
8652001-08-06 Mario Lang <mlang@delysid.org>
866
867 * erc.el:
868 added local-variable channel-list in session-buffers and make /LIST use it.
869 erc-join-channel can now do completion after /LIST was executed
870
8712001-08-05 Mario Lang <mlang@delysid.org>
872
873 * erc.el: Tweaked erc-join-channel and erc-part-from-channel
874
8752001-07-27 Mario Lang <mlang@delysid.org>
876
877 * erc.el: some more defcustom stuff
878
879 * erc.el: Patch from Henrik Enberg <henrik@enberg.org>:
880 Adds variables erc-frame-alist and erc-frame-dedicated-p.
881
882 * erc.el: fixed erc-part-from-channel
883
884 * erc.el:
885 fixed match-string problem and added interactive topic setting function.
886
887 * erc.el: fixed silly string-match bug
888
889 * erc.el:
890 Added erc-join-channel and erc-part-from-channel (interactive prompts), as well as keybindings. C-c C-j #emacs RET is now enough :)
891
8922001-07-27 Alex Schroeder <alex@gnu.org>
893
894 * erc.el(erc-display-line-buffer): Simplified filling.
895 (erc-fill-region): New function.
896
8972001-07-27 Mario Lang <mlang@delysid.org>
898
899 * erc.el: Added redundancy check in output
900
9012001-07-26 Alex Schroeder <alex@gnu.org>
902
903 * erc.el(erc-send-action): Add text-property stuff.
904 (erc-input-action): Removed text-property stuff.
905 (erc-command-table): Corrected command for DESCRIBE. Still
906 doesn't work though. No idea what it should do. Looks like a no op.
907 (erc-cmd-me): Doc change.
908
9092001-07-26 Mario Lang <mlang@delysid.org>
910
911 * erc.el:
912 fixed one occurence of a setq with only one argument (XEmacs didnt like that)
913
914 * erc.el:
915 Added erc-next-line-add-newlines customisation possibility.
916
917 * erc.el:
918 added erc-fill-prefix for defining your own way of filling and fixed filling somehow
919
920 * erc.el:
921 fixed small incompatibility in erc-parse-line-from-server at (and (= n 353) regexp
922
9232001-07-25 Mario Lang <mlang@delysid.org>
924
925 * erc.el:
926 Added erc-filling and filling code to erc-display-line-buffer.
927
9282001-07-08 Alex Schroeder <alex@gnu.org>
929
930 * erc.el(try-complete-erc-nick): Make the ": " part of the
931 expansion
932
933 * erc.el: require ring
934
9352001-07-08 Mario Lang <mlang@delysid.org>
936
937 * erc.el: *** empty log message ***
938
9392001-07-07 Mario Lang <mlang@delysid.org>
940
941 * erc.el: typo
942
943 * erc.el: ommit
944 :wq
945
9462001-07-06 Alex Schroeder <alex@gnu.org>
947
948 * erc.el(erc-mode): Call erc-input-ring-setup.
949 (erc-send-current-line): Call erc-add-to-input-ring.
950 (erc-input-ring): New variable. Currently not buffer local.
951 (erc-input-ring-index): New variable. Currently not buffer local.
952 (erc-input-ring-setup): New function.
953 (erc-add-to-input-ring): New function.
954 (erc-previous-command): New function.
955 (erc-next-command): New function.
956 (erc-mode-map): Uncommented keybindings for erc-next-command and
957 erc-previous-command.
958
9592001-07-05 Alex Schroeder <alex@gnu.org>
960
961 * erc.el(erc-highlight-strings): Removed debug message.
962
963 * erc.el(erc-join-buffer): Changed default to 'buffer.
964 (erc-join-info-buffer): Changed default to 'disable.
965 (erc-nick-completion): Changed default to 'all.
966
9672001-07-04 uid31117 <uid31117@confusibombus>
968
969 * erc.el: Resolved...
970
9712001-07-03 Alex Schroeder <alex@gnu.org>
972
973 * erc.el(erc-highlight-strings): New option and new function.
974 (erc-parse-line-from-server): Use it.
975 Various empty lines removed. Various doc strings fixed.
976
977 * erc.el: Removed more empty lines.
978
979 * erc.el(erc-member-string): replaced by plain member
980 Otherwise, lots of deleting of empty lines... I'm not too happy with that
981 but I feel better when the code is "cleaned up".
982
9832001-07-03 Mario Lang <mlang@delysid.org>
984
985 * erc.el: Ugly hack, but looks nicer when giving commands
986
987 * erc-speak.el: ugly hack, but looks nicer now
988
9892001-07-03 Alex Schroeder <alex@gnu.org>
990
991 * erc.el(try-complete-erc-nick): New function.
992 (erc-try-complete-nick): New function.
993 (erc-nick-completion): New option.
994 (erc-complete): Call hippie-expand such that erc-try-complete-nick
995 will be called eventually. Based on erc-nick-completion
996 try-complete-erc-nick will then complete on the nick at point.
997
9982001-07-02 Mario Lang <mlang@delysid.org>
999
1000 * erc.el:
1001 Insert (erc-current-nick) instead of (erc-display-prompt). good night :)
1002
1003 * erc.el:
1004 small, but it was anoying, so I just did it (defcustom for erc-join-buffer and erc-join-info-buffer)
1005
10062001-06-29 Alex Schroeder <alex@gnu.org>
1007
1008 * erc.el: Use defface to define all faces.
1009 Removed some history from the commentary, as well as some other
1010 commentary editing.
1011
10122001-06-28 Mario Lang <mlang@delysid.org>
1013
1014 * erc.el: hmm, defcustom for erc-user-full-name
1015
1016 * erc-speak.el, erc.el: *** empty log message ***
1017
10182001-06-27 Mario Lang <mlang@delysid.org>
1019
1020 * erc.el: typo
1021
1022 * erc.el: Some more defcustom
1023
1024 * erc-speak.el: nothing, really
1025
10262001-06-26 Mario Lang <mlang@delysid.org>
1027
1028 * erc.el: Some defcustom stuff. Still no defgroup though :)
1029
1030 * erc.el:
1031 Initial change to erc.el (2.0). Mainly list of ideas and features
1032 and syntax-table entries.
1033
1034 * erc-speak.el, erc.el: Initial Import
1035
1036 * erc-speak.el, erc.el: New file.
1037
1038 Copyright (C) 2001 Free Software Foundation, Inc.
1039 Copying and distribution of this file, with or without modification,
1040 are permitted provided the copyright notice and this notice are preserved.
1041
1042;; arch-tag: 306c4b58-f9ae-4f3d-9fd9-db2d743f05a6
diff --git a/lisp/erc/ChangeLog.2002 b/lisp/erc/ChangeLog.2002
new file mode 100644
index 00000000000..0851f3bcfef
--- /dev/null
+++ b/lisp/erc/ChangeLog.2002
@@ -0,0 +1,2601 @@
12002-12-31 Francis Litterio <franl@users.sourceforge.net>
2
3 * erc.el(erc-split-command):
4 Removed assignment to free variable "continue".
5 (erc-strip-controls): New function. Takes a string, returns the string with
6 all IRC color/bold/underline/etc. control codes stripped out.
7 (erc-interpret-controls): If variable erc-interpret-controls-p is nil, now
8 uses erc-strip-controls to strip control codes.
9 (erc-ctcp-reply-ECHO): Changed reference and assignment to free variable "s"
10 into reference/assignment to "msg", which appears to be the original author's
11 intent.
12
13 * erc-list.el(erc-chanlist):
14 Changed to use the new erc-once-with-server-event function
15 instead of the old macro of the same name.
16
17 * erc-notify.el(erc-notify-timer):
18 Changed to use the new erc-once-with-server-event function
19 instead of the old macro of the same name. Also fixed a bug were variable
20 erc-last-ison was being read from a non-server buffer (thus giving its default
21 value instead of its per-server value).
22
23 * erc.el(erc-once-with-server-event):
24 This is now a function. It was a macro with a
25 bug (the call to gensym happened at byte-compile-time not macro-call-time).
26 (erc-toggle-debug-irc-protocol): Now [return] is bound to this function in
27 the *erc-protocol* buffer.
28
292002-12-30 Alex Schroeder <alex@gnu.org>
30
31 * erc-autoaway.el(erc-autoaway-idletimer): Doc,
32 ref. erc-autoaway-use-emacs-idle.
33 (autoaway): Doc, explain different idle definitions. Reestablish
34 the idletimer only when erc-autoaway-use-emacs-idle is non-nil.
35 (erc-auto-set-away): Doc, ref erc-auto-discard-away.
36 (erc-auto-discard-away): Doc, ref erc-auto-set-away.
37 (erc-autoaway-use-emacs-idle): Doc, ref erc-autoaway-mode, and
38 added a note that this feature is currently broken.
39 (erc-autoaway-reestablish-idletimer): Doc.
40 (erc-autoaway-possibly-set-away): Split test such that
41 erc-time-diff is only computed when necessary, add a comment why
42 erc-process-alive is not necessary.
43 (erc-autoaway-set-away): Test for erc-process-alive.
44
452002-12-29 Alex Schroeder <alex@gnu.org>
46
47 * erc-autoaway.el:
48 Changed the order of defcustoms to avoid errors in the :set property
49 of erc-autoaway-idle-seconds.
50
512002-12-29 Damien Elmes <erc@repose.cx>
52
53 * erc-track.el:
54 * (erc-track-get-active-buffer): remove superflous (+ arg 0)
55
562002-12-29 Alex Schroeder <alex@gnu.org>
57
58 * erc-autoaway.el(erc-autoaway): Moved the defgroup up to the
59 top, before the define-erc-module call.
60 (autoaway): Extended doc.
61 (erc-autoaway-idle-seconds): Use a :set property to handle
62 erc-autoaway-use-emacs-idle.
63 (erc-auto-set-away): Set default to t. Added doc strings where
64 necessary, reformatted doc strings such that the first line can
65 stand on its own. This is important for the output of M-x
66 apropos.
67
682002-12-28 Jorgen Schaefer <forcer@users.sourceforge.net>
69
70 * erc-auto.in:
71 added (provide 'erc-auto), which is required for (require 'erc-auto) :)
72
73 * erc.el(erc-display-prompt):
74 Set the face property of the prompt to
75 everything but the last character.
76
77 * erc.el(erc-send-current-line):
78 Check wether point is in the input line. If
79 not, just beep and do nothing.
80
812002-12-28 Alex Schroeder <alex@gnu.org>
82
83 * erc.el(erc-bol):
84 Fixed bug when there is only a prompt, and no property
85 change.
86
87 * erc.el(erc-display-prompt): Rewrote using a save-excursion
88 and erc-propertize. No longer use a field for the prompt, but a
89 plain text property called erc-prompt.
90 (erc-bol): Use the erc-prompt text property instead of a field.
91 Return point instead of t.
92 (erc-parse-current-line): No need to call point here, then, since
93 erc-bol now returns point.
94
95 * Makefile:
96 make ChangeLog .PHONY, thus forcing it always to be rebuilt.
97
982002-12-28 Jorgen Schaefer <forcer@users.sourceforge.net>
99
100 * erc.el(erc-log-irc-protocol):
101 Removed check wether get-buffer-create
102 returned nil. "The value is never nil", says the docstring.
103
104 * erc.el: Day Of The Small Changes
105
106 (erc-display-prompt): Make the prompt 'front-sticky, which prevents it
107 from being modified. It *should* also make end-of-line move to the
108 end of the field (i.e. the end of the prompt) when point is at the
109 beginning of the prompt, but it doesn't. Dunno why. :(
110
1112002-12-27 Francis Litterio <franl@users.sourceforge.net>
112
113 * Makefile:
114 Added "-f" to "rm" command in rule for target "realclean".
115
116 * erc.el:
117 New function: erc-log-irc-protocol. Consolidates nearly duplicate code
118 from functions erc-send-command and erc-process-filter into one function.
119
120 * erc.el(erc-toggle-debug-irc-protocol):
121 Removed unneeded argument PREFIX and code
122 which referenced it at end of function.
123 (erc-send-command): Now we only append a newline to the logged copy
124 of output protocol text if it doesn't have one.
125
1262002-12-27 Jorgen Schaefer <forcer@users.sourceforge.net>
127
128 * erc.el(erc-toggle-debug-irc-protocol):
129 Display buffer if it's not shown
130 already, and use view-mode.
131 (erc-toggle-debug-irc-protocol), (erc-send-command),
132 (erc-process-filter): inhibit-only t to insert into the
133 *erc-protocol* buffer (view-mode)
134
1352002-12-27 Francis Litterio <franl@users.sourceforge.net>
136
137 * erc.el(erc-mode-map):
138 Removed keybinding for erc-toggle-debug-irc-protocol.
139 (erc-toggle-debug-irc-protocol): Now used erc-make-notice to propertize the
140 face of the enabled/disabled messages in the *erc-protocol* buffer.
141 (erc-send-command): Now outgoing IRC protocol traffic is logged too.
142
143 * erc.el:
144 Added user-customizable variable erc-debug-irc-protocol.
145 Added function erc-toggle-debug-irc-protocol.
146 (erc-process-filter): Now supports IRC protocol logging. If variable
147 erc-debug-irc-protocol is non-nil, all IRC protocol traffic is appended
148 to buffer *erc-protocol*, which is created if necessary.
149
1502002-12-27 Jorgen Schaefer <forcer@users.sourceforge.net>
151
152 * erc.el(erc-display-prompt):
153 Don't make the prompt intangible; that didn't
154 make things that much better for the user, but confused ispell,
155 which checked the prompt when it should check the first word
156
1572002-12-27 Alex Schroeder <alex@gnu.org>
158
159 * AUTHORS: fixed resolve's email add
160
161 * AUTHORS: added damien
162
163 * erc.el(erc-truncate-buffer-on-save):
164 Removed documentation that
165 described behaviour now changed. It used to say "When nil, no
166 buffer is ever truncated." This is no longer true; even when
167 buffers are NOT truncated on save, they can be truncated, eg. by
168 adding erc-truncate-buffer to the hook.
169 (erc-logging-enabled): New function.
170 (erc-current-logfile): New function.
171 (erc): Use erc-logging-enabled and erc-current-logfile.
172 (erc-truncate-buffer-to-size): Rewrote it, and made sure to use a
173 (save-restriction (widen) ...) such that the truncation actually
174 runs in the whole buffer, not in the last message only (as
175 erc-insert-post-hook will do!). This should fix rw's
176 out-of-bounds error.
177 (erc-generate-log-file-name-short): Made all but the BUFFER
178 argument optional. Doc: Mention
179 erc-generate-log-file-name-function.
180 (erc-generate-log-file-name-long): Doc: Mention
181 erc-generate-log-file-name-function.
182 (erc-save-buffer-in-logs): Use erc-logging-enabled and
183 erc-current-logfile. Doc: Mention erc-logging-enabbled.
184
185 (erc-encode-string-for-target): Only do the real work when
186 featurep mule; else just return the string unchanged.
187
1882002-12-27 Damien Elmes <erc@repose.cx>
189
190 * erc.el:
191 erc-encoding-default: check for (coding-system-p) for older emacs versions
192
193 * erc.el(erc-connect): missing ()s added. "don't commit at 2am"
194
195 * erc.el(erc-connect):
196 check if (set-process-coding-system) is available before use
197
1982002-12-27 Alex Schroeder <alex@gnu.org>
199
200 * AUTHORS: added franl
201
2022002-12-26 Alex Schroeder <alex@gnu.org>
203
204 * erc-pcomplete.el(pcomplete-parse-erc-arguments):
205 Reworked, and fixed a bug that had
206 caused completions to corrupt preceding text under some circumstances.
207
208 * erc.el(erc-encoding-default): New.
209 (erc-encode-string-for-target): Use it instead of a hard-coded ctext.
210 (erc-encoding-coding-alist): Doc.
211
2122002-12-26 Francis Litterio <franl@users.sourceforge.net>
213
214 * erc.el:
215 Removed fix for bug 658552 recently checked-in, because it doesn't work.
216
217 * erc.el(erc-kill-buffer-function):
218 Removed check that connection is up
219 before running erc-kill-server-hook hooks. Those hooks should use
220 erc-process-alive to avoid interacting with the process.
221
222 * erc.el:
223 Fixed erc-send-current-line so it no longer assigns the free variable "s", and
224 it doesn't move point to end-of-buffer in non-ERC buffers. Fixed
225 erc-kill-buffer-function so it doesn't run the erc-kill-server-hook hooks if the
226 server connection is closed. Fixed bug 658552, which is described in detail at
227 http://sourceforge.net/tracker/index.php?func=detail&aid=658552&group_id=30118&atid=398125
228
2292002-12-26 Alex Schroeder <alex@gnu.org>
230
231 * erc.el(erc-cmd-SMV): Bug, now call erc-version-modules.
232
233 * erc-pcomplete.el(erc-pcomplete-version): New.
234
2352002-12-26 Francis Litterio <franl@users.sourceforge.net>
236
237 * erc-pcomplete.el:
238 Fix for bug where you could not complete a nick when there was text following
239 the nick.
240
2412002-12-25 Alex Schroeder <alex@gnu.org>
242
243 * erc.el(erc-already-logged-in): Use erc-process-alive.
244 (erc-prepare-mode-line-format): Use erc-process-alive.
245 (erc-process-alive): Check erc-process for boundp and processp.
246
247 * erc.el(erc-kill-buffer-function):
248 Do not check wether the process is
249 alive before running the hook, because there might be functions on
250 the hook that need to run even when the process is dead. And
251 function that wants to check this, should use (erc-process-alive).
252 (erc-process-alive): New function.
253 (erc-kill-server): Use it.
254 (erc-kill-channel): Use it.
255
256 * erc.el(erc-kill-buffer-function):
257 Reverted ignore-error change.
258 ignore-error is dangerous because we might miss bugs in functions
259 on erc-kill-server-hook.
260
261 * erc.el(erc-kill-buffer-function): Use memq instead of member
262 when checking process-status. Added doc string with references to
263 the other hooks.
264 (erc-kill-server): Only send the command when the erc-process is
265 still alive. This prevents the error: "Process
266 erc-irc.openprojects.net-6667 not running" when killing the buffer
267 after having used /QUIT.
268
2692002-12-24 Jorgen Schaefer <forcer@users.sourceforge.net>
270
271 * erc.el(erc-server-ERROR):
272 Show the error reason, not only the originating host.
273
274 * erc.el(erc-kill-buffer-function):
275 (ignore-errors ...) in 'erc-kill-server-hook.
276 When the process for this server does not exist anymore, the hook
277 will cause an error, effectively preventing the buffer from being
278 killed.
279
2802002-12-24 Francis Litterio <franl@users.sourceforge.net>
281
282 * erc-notify.el:
283 Fixed erc-notify-timer so that it passes the correct nick to
284 the functions on erc-notify-signoff-hook.
285
2862002-12-24 Alex Schroeder <alex@gnu.org>
287
288 * erc-track.el: Doc
289
290 * erc-track.el(erc-make-mode-line-buffer-name): Removed a
291 superfluous if construct around erc-track-showcount-string.
292 (erc-track-modified-channels): Use 1+.
293 Plus some doc and comment changes.
294
2952002-12-23 Mario Lang <mlang@delysid.org>
296
297 * erc.el: Fix (erc-version) string
298
2992002-12-23 Francis Litterio <franl@users.sourceforge.net>
300
301 * erc.el:
302 Removed unnecessary assignment to free-variable "p" in erc-downcase.
303
304 * erc.el:
305 Now /PART reason strings are generated the same way /QUIT reason strings
306 are generated (see variable erc-part-reason). Also, when a server buffer
307 is killed, a QUIT command is automatically sent to the server.
308
309 * erc.el:
310 Changed erc-string-no-properties so that it is more efficient. Now it uses
311 set-text-properties instead of creating and deleting a temporary buffer.
312
3132002-12-21 Jorgen Schaefer <forcer@users.sourceforge.net>
314
315 * erc.el:
316 erc-kill-input: added a check to prevent a (ding) and an error when
317 there's nothing to kill (thanks to Francis Litterio, franl on IRC)
318
3192002-12-21 Mario Lang <mlang@delysid.org>
320
321 * erc.el:
322 AWAY notice duplication prevention. erc-prevent-duplicates now set to ("301") by default, and timeout to 60
323
324 * erc.el: erc-prevent-duplicates: New variable, see docstring
325
3262002-12-20 Jorgen Schaefer <forcer@users.sourceforge.net>
327
328 * erc-track.el:
329 erc-track-modified-channels: Use cddr of cell for old-face. cdr of
330 cell is '(1 . face-name), i have no idea why :)
331
3322002-12-20 Damien Elmes <erc@repose.cx>
333
334 * erc.el(erc-current-nick):
335 check the server buffer is active before using
336
337 Also tabified and cleaned up some trailing whitespace
338
3392002-12-15 Mario Lang <mlang@delysid.org>
340
341 * erc-track.el: erc-track-count patch by az
342
3432002-12-14 Damien Elmes <erc@repose.cx>
344
345 * erc.el:
346 last-peers: initialise to a cons. thanks to Francis Litterio
347 <franl@world.std.com> for the patch
348
349 * erc.el:
350 erc-kill-channel-hook, erc-kill-buffer-hook, (erc-kill-channel):
351 both hooks now call erc-save-buffer-in-logs, so that query buffers are
352 saved properly now, and not just channel buffers.
353
3542002-12-13 Alex Schroeder <alex@gnu.org>
355
356 * erc-track.el(erc-unique-channel-names): Fix another #hurd
357 vs. #hurd-bunny bug.
358
359 * erc-match.el(match): No longer modify erc-send-modify-hook,
360 since it does not work without a parsed text property, anyway.
361 (erc-keywords): Allow cons cells.
362 (erc-remove-entry-from-list): Deal with cons cells.
363 (erc-keyword-p): Ditto.
364 (erc-match-message): Ditto.
365
366 Moved nil to the beginning of the list, removed :tags for the
367 -type variables:
368 (erc-current-nick-highlight-type): Ditto.
369 (erc-pal-highlight-type): Ditto.
370 (erc-fool-highlight-type): Ditto.
371 (erc-keyword-highlight-type): Ditto.
372 (erc-dangerous-host-highlight-type): Ditto.
373 (erc-log-matches-flag): Moved nil to the beginning.
374
3752002-12-11 Jorgen Schaefer <forcer@users.sourceforge.net>
376
377 * erc.el:
378 erc-beg-of-input-line: Don't do (goto-char (beginning-of-line)), since
379 beginning-of-line always moves point and returns nil. Thanks to
380 franl on IRC for noting this.
381
382 * erc-stamp.el:
383 erc-insert-timestamp-left, erc-insert-timestamp-right: Made the
384 timestamp a 'field named 'erc-timestamp. Now end-of-line and
385 beginning-of-line will move over the timestamp.
386
3872002-12-10 Damien Elmes <erc@repose.cx>
388
389 * erc-button.el(erc-button-add-button):
390 make the created button rear-nonsticky, to allow
391 cutting and pasting of buttons without worrying about the button properties
392 being inherited by the text typed afterwards.
393
394 * erc.el: save logfile when killing buffer
395
3962002-12-09 Alex Schroeder <alex@gnu.org>
397
398 * erc-track.el(erc-modified-channels-display): Reworked.
399 (erc-track-face-more-important-p): Removed.
400 (erc-track-find-face): Return only one face.
401 (erc-track-modified-channels): Reworked.
402 (erc-modified-channels-string): Changed from (BUFFER FACE...) to
403 (BUFFER . FACE)
404
405 * erc-stamp.el(erc-insert-timestamp-right): Do not assume
406 erc-fill-column is available.
407
4082002-12-09 Jorgen Schaefer <forcer@users.sourceforge.net>
409
410 * erc.el:
411 erc-ech-notices-in-minibuffer-flag, erc-minibuffer-notice: Clarified
412 the difference in the docstrings.
413
4142002-12-08 Jorgen Schaefer <forcer@users.sourceforge.net>
415
416 * erc.el: erc-noncommands-list: added erc-cmd-SM and erc-cmd-SMV
417
4182002-12-08 Alex Schroeder <alex@gnu.org>
419
420 * erc.el(erc-cmd-SM): New.
421 (erc-cmd-SMV): New.
422
423 * erc.el(erc-modes): New.
424
4252002-12-08 Jorgen Schaefer <forcer@users.sourceforge.net>
426
427 * erc-compat.el:
428 field-end: use (not (fboundp 'field-end)) instead of (featurep 'xemacs)
429
4302002-12-08 Alex Schroeder <alex@gnu.org>
431
432 * erc.el(erc-version-modules): New.
433
4342002-12-08 Mario Lang <mlang@delysid.org>
435
436 * debian/changelog, debian/control, debian/scripts/startup.erc:
437 debian release 3.0.cvs.20021208
438
4392002-12-08 Jorgen Schaefer <forcer@users.sourceforge.net>
440
441 * erc.el(erc-split-command): Do the right thing with CTCPs.
442
4432002-12-08 Mario Lang <mlang@delysid.org>
444
445 * erc-stamp.el: Be a bit more functional
446
4472002-12-08 Jorgen Schaefer <forcer@users.sourceforge.net>
448
449 * erc-compat.el:
450 XEmacs doesn't seem to have field-end, so we provide our own version here.
451
4522002-12-08 Mario Lang <mlang@delysid.org>
453
454 * Makefile: Small fixes to debrelease target
455
4562002-12-08 Jorgen Schaefer <forcer@users.sourceforge.net>
457
458 * erc.el:
459 make-obsolete-variable: xemacs doesn't have the WHEN parameter, remove it.
460
4612002-12-07 Jorgen Schaefer <forcer@users.sourceforge.net>
462
463 * erc-imenu.el(erc-create-imenu-index):
464 Use (forward-line 0) instead of
465 (beginning-of-line) now, sine the latter ignores fields (used in the
466 prompt).
467
468 * erc.el:
469 Rewrite of the prompt stuff to use a field named 'erc-prompt:
470
471 erc-prompt: Removed getter and setter functions. The properties were
472 already set (and overwritten) in erc-display-prompt.
473 (erc-prompt): Add the trailing space here, not all over the code.
474 (erc-display-prompt): Cleaned up a bit. The text-properties now are
475 valid on the whole prompt. Also, made the prompt 'intangible to
476 avoid confused users.
477 (erc-bol): Now use the field 'erc-prompt for finding the prompt
478 (erc-parse-current-line): Cleaned up considerably. Uses (erc-bol) now.
479 (erc-load-irc-script-lines): Adjusted for the new (erc-prompt).
480 (erc-save-buffer-in-logs): Adjusted for the new (erc-prompt).
481
482 * erc.el:
483 erc-uncontrol-input-line: The comment said "Consider it deprecated",
484 so I removed it now.
485 erc-prompt-interactive-input: Marked obsolete as of previous change.
486
487 * erc.el:
488 erc-smiley, erc-unmorse: Put at the end to separate it from the
489 important parts of erc.el.
490
4912002-12-07 Alex Schroeder <alex@gnu.org>
492
493 * erc-stamp.el(erc-insert-timestamp-right): New algorithm.
494
4952002-12-07 Jorgen Schaefer <forcer@users.sourceforge.net>
496
497 * erc.el:
498 last-peers, erc-message: Explained what last-peers is used for.
499
5002002-12-07 Alex Schroeder <alex@gnu.org>
501
502 * erc-page.el(erc-cmd-PAGE): New function.
503 (erc-ctcp-query-PAGE): Use the catalog entry for the message, too.
504 (erc-ctcp-query-PAGE-hook): Added custom type.
505 (erc-page-function): Changed custom type from ... function-item to
506 ... function.
507 As well as doc strings.
508
5092002-12-06 Alex Schroeder <alex@gnu.org>
510
511 * erc-page.el: provide feature at the end
512
5132002-12-06 Brian P Templeton <bpt@tunes.org>
514
515 * erc-nickserv.el:
516 Added austnet in erc-nickserv.el (thanks to Damien Elmes
517 <resolve@repose.cx>)
518
5192002-12-05 Mario Lang <mlang@delysid.org>
520
521 * erc-complete.el: Add autoload cookie
522
523 * erc-speak.el: Small fix to make proper voice-changes
524
5252002-12-05 Alex Schroeder <alex@gnu.org>
526
527 * erc-lang.el: New
528
5292002-12-03 Jorgen Schaefer <forcer@users.sourceforge.net>
530
531 * erc.el:
532 erc-mode-map: Put back C-c C-p (PART) and C-c C-q (QUIT)
533
5342002-12-02 Jorgen Schaefer <forcer@users.sourceforge.net>
535
536 * erc.el:
537 erc-insert-post-hook: Add :options erc-make-read-only, erc-save-buffer-in-logs
538 erc-send-post-hook: Add :options erc-make-read-only
539
540 * erc.el: erc-insert-hook: Removed ("this hook is obsolescent")
541 erc-insert-post-hook: Added :options '(erc-truncate-buffer)
542
5432002-12-02 Mario Lang <mlang@delysid.org>
544
545 * erc.el: Add missing requires
546
5472002-11-29 Jorgen Schaefer <forcer@users.sourceforge.net>
548
549 * erc.el(erc-quit-reason-normal):
550 Remove v before %s so it's "Version ..." not
551 "vVersion ..."
552
5532002-11-26 Alex Schroeder <alex@gnu.org>
554
555 * erc-compat.el(erc-encode-coding-string): Add second argument
556 coding-system, and for non-mule xemacsen, use a new defun instead
557 of identity.
558
559 * erc.el: (define-erc-module): Use the appropriate group.
560 (erc-port): Changed custom type.
561 (erc-insert-hook): Custom group changed to erc-hooks.
562 (erc-after-connect): ditto
563 (erc-before-connect): ditto
564 (erc-disconnected-hook): ditto
565
566 * erc-button.el(erc-button): New group, changed all custom groups
567 from erc to erc-button, but left all erc-faces as-is.
568
569 * erc-track.el(erc-track): New group, changed all custom groups
570 from erc to erc-track.
571
5722002-11-26 Mario Lang <mlang@delysid.org>
573
574 * erc-macs.el:
575 Macros for erc-victim handling. Primary idea is to use setf and some fancy things to get nice syntax. have a look
576
5772002-11-26 Jorgen Schaefer <forcer@users.sourceforge.net>
578
579 * erc.el:
580 pings, erc-cmd-PING, erc-ctcp-reply-PING, catalog entry CTCP-PING:
581 Cleaned up. Removed buffer-local variable pings which stored a list of
582 all sent CTCP PING requests. Now send our full time with the CTCP PING
583 request and interpret the answer.
584
5852002-11-25 Jorgen Schaefer <forcer@users.sourceforge.net>
586
587 * erc.el: nick-stk: replaced by the local variable current-nick.
588
5892002-11-25 Alex Schroeder <alex@gnu.org>
590
591 * erc.el(erc-send-command): Use erc-encode-string-for-target.
592 (erc-encode-string-for-target): New.
593
594 * erc-compat.el(erc-encode-coding-string): Add second argument
595 coding-system, and for non-mule xemacsen, use a new defun instead
596 of identity.
597
598 * erc-nickserv.el(erc-nickserv-version): New.
599
6002002-11-25 Jorgen Schaefer <forcer@users.sourceforge.net>
601
602 * Makefile:
603 UNCOMPILED: erc-chess.el depends on chess-network.el, which might not
604 be installed. Don't compile it.
605
606 * erc.el:
607 erc-mode-map: Added C-a as erc-bol (no reason why it shouldn't be),
608 and removed C-c C-p (part channel) and C-c C-q (quite server) as these
609 are a bit drastic in their consequences and easy to mistype.
610
6112002-11-24 Jorgen Schaefer <forcer@users.sourceforge.net>
612
613 * erc-track.el: erc-track-faces-priority-list: Extended list
614
615 * erc.el:
616 channel-members: Updated docstring: We have a VOICE predicate, too.
617
618 * erc-track.el(erc-unique-substrings):
619 Don't shorten a single channel to "#", but
620 always give at least 2 chars (except when there are no two chars).
621
6222002-11-23 Jorgen Schaefer <forcer@users.sourceforge.net>
623
624 * erc-nickserv.el:
625 support for BrasNET. Thanks to rw on IRC for the settings.
626
6272002-11-23 Alex Schroeder <alex@gnu.org>
628
629 * erc.el: (erc-default-recipients, erc-session-user-full-name)
630 (nick-stk, pings, erc-announced-server-name, erc-connected)
631 (channel-user-limit, last-peers, invitation, away, channel-list)
632 (last-sent-time, last-ping-time, last-ctcp-time, erc-lines-sent)
633 (erc-bytes-sent, quitting, bad-nick, erc-logged-in)
634 (erc-default-nicks): Defvars.
635
636 * erc-compat.el: Switched tests to iso-8859-1 instead of latin-1.
637
638 * erc-compat.el(erc-compat-version): New.
639
6402002-11-22 Alex Schroeder <alex@gnu.org>
641
642 * erc.el(smiley): Smileys are a very small module, now.
643
6442002-11-22 Jorgen Schaefer <forcer@users.sourceforge.net>
645
646 * erc.el:
647 erc-event-to-hook, erc-event-to-hook-name: eval-and-compile these,
648 since we need them in a macro. ERC now compiles again!
649
650 * erc-speak.el:
651 erc-minibuffer-privmsg: Removed setting this variable to nil, since it
652 was removed from erc.el.
653
654 * erc.el(erc-interactive-input-map): Added docstring.
655 (erc-wash-quit-reason): Extended docstring.
656 (erc-server-ERROR): Added docstring.
657 (erc-server-321): buffer-local variable channel-list probably
658 shouldn't be renamed erc-channel-list - removed FIXME.
659
660 * erc.el: small cleanup.
661 ("was not used anymore" here means "not used in erc/*.el nor in
662 fsbot", thanks to deego for checking that.)
663
664 erc-minibuffer-privmsg: Removed (was not used anymore)
665 (erc-reformat-command): Removed (was not used anymore)
666 (erc-strip-erc-parsed-property): Removed (was not used anymore)
667 (erc-process-ctcp-response): Removed (replaced by ctcp-query-XXX-hook)
668 (erc-send-paragraph): Removed ("Note that this function is obsolete,
669 erc-send-current-line handles multiline input.")
670 (erc-input-hook): Removed ("This hook is obsolete. See
671 `erc-send-pre-hook', `erc-send-modify-hook' and
672 `erc-send-post-hook' instead.")
673 (erc-message-hook): Removed ("This hook is obsolete. See
674 `erc-server-PRIVMSG-hook' and `erc-server-NOTICE-hook'.")
675 (erc-cmd-default-channel): Removed ("FIXME: no clue what this is
676 supposed to do." - it was supposed to prepend the default channel
677 to a command before sending it. E.g. typing "/FOO now!" would send
678 the IRC command "FOO #mycurrentchannel now!")
679
680 * erc.el:
681 erc-ctcp-query-PING: Send the whole argument back, not just the first
682 number. This is required for many clients (e.g. irssi, BitchX, ...)
683 which send their ping times in two different numbers for microsecond
684 accuracy.
685
6862002-11-22 Alex Schroeder <alex@gnu.org>
687
688 * erc-track.el(erc-track-shorten-function): Allow nil.
689
6902002-11-21 Alex Schroeder <alex@gnu.org>
691
692 * erc-track.el(erc-unique-channel-names): Fixed bug that appeared
693 if one target name was a substring of another -- eg. #hurd and
694 #hurd-bunny. Added appropriate test.
695
6962002-11-20 Jorgen Schaefer <forcer@users.sourceforge.net>
697
698 * erc-track.el:
699 erc-unique-channel-names: Don't take a substring of channel that could
700 be longer than the channel, but at most (min (length candidate)
701 (length channel). (thanks to deego for noticing this)
702
7032002-11-19 Mario Lang <mlang@delysid.org>
704
705 * erc-notify.el: * (require pcomplete): Only when compiling.
706
7072002-11-19 Jorgen Schaefer <forcer@users.sourceforge.net>
708
709 * erc-track.el:
710 erc-track-faces-priority-list: New variable, defines what faces will
711 be shown in the modeline. If set to nil, the old behavior ("all")
712 remains.
713 erc-track-face-more-important-p: new function
714 erc-track-find-face: new function
715
7162002-11-19 Alex Schroeder <alex@gnu.org>
717
718 * erc-fill.el(erc-stamp): Require it.
719
720 * erc-match.el(away): devar for the compiler.
721
722 * erc-stamp.el(stamp): Moved.
723
724 * erc.el(erc-version-string): New version.
725
726 * erc-autoaway.el(erc-autoaway-idletimer): Moved to the front of
727 the file.
728
729 * erc-auto.in: (generated-autoload-file, command-line-args-left):
730 Added defvar without value to silence byte compiler.
731
732 * Makefile(realclean): renamed fullclean to realclean.
733 (UNCOMPILED): New list, for erc-bbdb.el, erc-ibuffer.el,
734 erc-speak.el.
735 (SOURCE): Do not compile UNCOMPILED.
736 (release): New target.
737 (ChangeLog): New target.
738 (todo): New target.
739
740 * erc-complete.el(erc-match): Require it.
741 (hippie-exp): Require it.
742
743 * erc-ezbounce.el(erc): Require it.
744
745 * erc-imenu.el(imenu): Require it.
746
747 * erc-nickserv.el(erc-networks): Moved up.
748
749 * erc-notify.el(pcomplete): Require it.
750
751 * erc-replace.el(erc): Require it.
752
753 * erc-sound.el(sound): Typo -- define-key in erc-mode-map.
754
755 * erc-speedbar.el(dframe): Require it.
756 (speedbar): Require it.
757
758 * erc-track.el(erc-default-recipients): devar for the compiler.
759
760 * README: New file.
761
7622002-11-18 Mario Lang <mlang@delysid.org>
763
764 * AUTHORS: File needed for mkChangeLog
765
766 * mkChangeLog: Original code by mhp
767
7682002-11-18 Alex Schroeder <alex@gnu.org>
769
770 * erc-button.el(erc-button-list): Renamed to erc-list and moved
771 to erc.el.
772
773 * erc.el(erc-list): New.
774
775 * erc-track.el(erc-make-mode-line-buffer-name): Simplified.
776 (erc-modified-channels-display): Simplified. Now works with all
777 faces, and fixes the bug that when two faces where used (bold
778 erc-current-nick-face), then no faces was added.
779
780 * erc-track.el: Lots of new tests. Moved some defuns around in
781 the file.
782 (erc-all-channel-names): Renamed.
783 (erc-all-buffer-names): New name, now include query buffers as
784 well.
785 (erc-modified-channels-update-inside): New variable.
786 (erc-modified-channels-update): Use it to prevent running display
787 if already inside it. This prevented debugging of
788 `erc-modified-channels-display'.
789 (erc-make-mode-line-buffer-name): Moved.
790 (erc-track-shorten-names): Don't test using erc-channel-p as that
791 failed with query buffers.
792 (erc-unique-substrings): Move setq i + 1 to the end of the while
793 loop, so that start is used as a default value instead of start +
794 1.
795
7962002-11-18 Jorgen Schaefer <forcer@users.sourceforge.net>
797
798 * erc-track.el:
799 erc-unique-substrings: define this before using it in assert
800
801 * erc.el:
802 with-erc-channel-buffer: Define *before* using this macro. This
803 hopefully fixes a bug noted on IRC.
804
805 * erc-notify.el:
806 erc-notify-signon-hook, erc-notify-signoff-hook: New hooks. They're
807 even run when their name suggests!
808
8092002-11-18 Alex Schroeder <alex@gnu.org>
810
811 * erc-list.el: Typo.
812
813 * erc-speedbar.el: Whitespace only.
814
815 * erc.el(define-erc-module): Avoid defining an alias if name and
816 alias are the same.
817
818 * erc-ibuffer.el: URL
819
820 * erc-imenu.el(erc-imenu-version): New constant.
821
822 * erc-ibuffer.el(erc-ibuffer-version): New constant.
823
824 * erc-ibuffer.el: File header, comments.
825
826 * erc-fill.el(erc-fill-version): New constant.
827
828 * erc-ezbounce.el(erc-ezb-version): New constant.
829
830 * erc-complete.el(erc-complete-version): New constant.
831
832 * erc-chess.el(erc-chess-version): New constant.
833
834 * erc-chess.el: Whitespace only.
835
836 * erc-bbdb.el(erc-bbdb-version): Typo.
837
838 * erc-bbdb.el(erc-bbdb-version): New constant.
839 Lots of whitespace changes. Changes to the header.
840
841 * erc-track.el(erc-track-shorten-aggressively): Doc.
842 (erc-all-channel-names): New function.
843 (erc-unique-channel-names): New function.
844 (unique-substrings): Renamed.
845 (erc-unique-substrings): New name
846 (unique-substrings-1): Renamed.
847 (erc-unique-substring-1): New name. Added lots of tests.
848 (erc-track-shorten-names): Call erc-unique-channel-names instead
849
850 * erc-match.el(match): Rewrote a as module.
851
8522002-11-17 Alex Schroeder <alex@gnu.org>
853
854 * erc-netsplit.el(erc-netsplit-version): New.
855 (netsplit): Defined as a module, replacing erc-netsplit-initialize
856 and erc-netsplit-destroy.
857
8582002-11-17 Jorgen Schaefer <forcer@users.sourceforge.net>
859
860 * erc-track.el(erc-track-switch-buffer):
861 define-erc-module defines erc-track-mode,
862 not erc-track-modified-channels-mode.
863
864 * erc.el:
865 Variables erc-play-sound, erc-sound-path, erc-default-sound,
866 erc-play-command, erc-ctcp-query-SOUND-hook and functions
867 erc-cmd-SOUND, erc-ctcp-query-SOUND, erc-play-sound, erc-toggle-sound
868 moved to erc-sound.el
869
870 Variables erc-page-function, erc-ctcp-query-PAGE-hook and function
871 erc-ctcp-query-PAGE moved to erc-page.el
872
873 * erc-page.el:
874 erc-page.el: New file. CTCP PAGE support for ERC, extracted from erc.el.
875
876 * erc-sound.el:
877 defin-erc-module: Typo. Autoload should do erc-sound-mode and "erc-sound".
878
879 * erc-sound.el:
880 erc-sound.el: New file. Contains all the CTCP SOUND stuff from erc.el.
881
882 * erc.el(erc-process-ctcp-request):
883 Removed (old-style CTCP handling)
884 (erc-join-autogreet): Removed (was broken anyways)
885
8862002-11-17 Alex Schroeder <alex@gnu.org>
887
888 * erc-button.el(erc-button-version): New constant.
889
890 * erc-button.el(button): rewrote as a module.
891
8922002-11-17 Jorgen Schaefer <forcer@users.sourceforge.net>
893
894 * erc.el: New functions:
895 (erc-event-to-hook), (erc-event-to-hook-name): Convert an event to the
896 corresponding hook. The latter only returns the name, while the former
897 interns the hook symbol and returns it.
898
8992002-11-17 Alex Schroeder <alex@gnu.org>
900
901 * erc-replace.el:
902 Practically total rewrite. All smiley stuff deleted.
903
904 * erc-track.el(track): typo.
905
906 * erc.el(define-erc-module): Doc change.
907
9082002-11-17 Jorgen Schaefer <forcer@users.sourceforge.net>
909
910 * erc-autoaway.el: Changed to use define-erc-module.
911
912 * erc.el(define-erc-module):
913 Make the enable/disable functions interactive.
914
915 * erc.el(erc):
916 Don't use switch-to-buffer when we're in the minibuffer,
917 because that does not work. Use display-buffer instead. This leaves
918 two problems: The point does not advance to the end of the buffer for
919 whatever reason, and after leaving the minibuffer, the new window gets
920 buried.
921
9222002-11-17 Alex Schroeder <alex@gnu.org>
923
924 * erc-stamp.el(stamp): Doc change.
925
926 * erc-stamp.el(erc-stamp-version): New constant.
927 (stamp): downcase alias name of the mode.
928
929 * erc.el(define-erc-module): Added defalias option, renamed
930 parameters again.
931
932 * erc-track.el: erc-track-modified-channels-mode is now only an
933 alias to erc-track-mode. Only erc-track-mode is autoloaded.
934 (track): Rewrote call to define-erc-module.
935
9362002-11-16 Mario Lang <mlang@delysid.org>
937
938 * debian/README.Debian: * Spelling fix
939
940 * erc-fill.el: * Fix autoload definition for erc-fill-mode
941
942 * debian/control, debian/maint/postinst, debian/maint/prerm:
943 * Remove /usr/doc -> /usr/share/doc link handling
944
945 * debian/changelog: * Sync with reality
946
947 * debian/scripts/startup.erc:
948 * Add /usr/share/emacs/site-lisp/erc/ to load-path
949 * (load "erc-auto")
950
951 * debian/README.Debian:
952 * Info about the changes since last release updated
953
954 * erc-pcomplete.el: * Fix emacs/xemacs compatibility
955
956 * debian/scripts/install: * Dont compile erc-compat, fix ELCDIR
957
958 * debian/control: * Change maintainer field
959
960 * erc.el:
961 * (defin-erc-module): Renamed argument mode-name to mname because silly byte-compiler thought we were talking about `mode-name'.
962
963 * Makefile: * Added debrelease target
964
965 * erc-bbdb.el, erc-pcomplete.el, erc-stamp.el, erc.el:
966 * (define-erc-module): Added mode-name argument.
967 * Converted erc-bbdb, erc-pcomplete and erc-stamp to new macro.
968 * autoload fixes
969
970 * erc-bbdb.el:
971 * Create a global-minor-mode (i.e., make it a proper erc-module)
972
973 * erc.el: * (define-erc-modle): New defmacro
974
9752002-11-16 Jorgen Schaefer <forcer@users.sourceforge.net>
976
977 * erc-autoaway.el(erc-autoaway-idle-seconds):
978 t in docstrings should be non-nil
979
9802002-11-16 Alex Schroeder <alex@gnu.org>
981
982 * erc-autoaway.el, erc-button.el, erc-fill.el, erc-match.el,
983 erc-menu.el, erc-ring.el, erc-track.el:
984 Cleanup of file headers: copyright years, GPL mumbo-jumbo, commentaries.
985
986 * erc-stamp.el(erc-insert-away-timestamp-function):
987 New custom type.
988 (erc-insert-timestamp-function): New custom type.
989
990 * erc-fill.el(erc-fill-function): Doc, new custom type.
991 (erc-fill-static): Doc.
992 (erc-fill-enable): New function.
993 (erc-fill-disable): New function.
994 (erc-fill-mode): New function.
995
996 * erc-match.el(erc-match-enable): add-hook for both
997 erc-insert-modify-hook and erc-send-modify-hook.
998 (erc-match-disable): remove-hook for both
999 erc-insert-modify-hook and erc-send-modify-hook.
1000
10012002-11-15 Jorgen Schaefer <forcer@users.sourceforge.net>
1002
1003 * erc-autoaway.el:
1004 - Added a way to use auto-away using emacs idle timers
1005 - Renamed erc-set-autoaway to erc-autoaway-possibly-set-away for consistency
1006
10072002-11-14 Jorgen Schaefer <forcer@users.sourceforge.net>
1008
1009 * erc.el: erc-mode-map: Removed the C-c C-g binding for erc-grab
1010
1011 * erc.el:
1012 (erc-server-341) Another instance of the channel/chnl problem i didn't
1013 see last time
1014
10152002-11-14 Alex Schroeder <alex@gnu.org>
1016
1017 * erc-compat.el(erc-decode-coding-string): typo
1018
10192002-11-14 Jorgen Schaefer <forcer@users.sourceforge.net>
1020
1021 * erc.el(erc-server-341):
1022 variable name should be chnl not channel, as it is
1023 used this way in this function, and the other erc-server-[0-9]* use
1024 chnl too.
1025
1026 * erc-autoaway.el:
1027 Set back on all servers, not just the current one, since we're set
1028 away on all servers as well.
1029
1030 * HISTORY: Fixed typo (ngu.org => gnu.org)
1031
1032 * erc-autoaway.el, erc-fill.el, erc.el: erc-autoaway.el:
1033 * new file
1034
1035 erc.el:
1036 * Removed auto-discard-away facility (now included in erc-autoaway.el)
1037 * (erc-away-p): new function
1038
1039 erc-fill.el:
1040 * (erc-fill-variable): Check wether erc-timestamp-format is bound before
1041 using it (erc-fill.el does not require erc-stamp).
1042
10432002-11-10 Alex Schroeder <alex@gnu.org>
1044
1045 * TODO:
1046 TODO: moved it to http://www.emacswiki.org/cgi-bin/wiki.pl?ErcTODO
1047
1048 * erc.el(with-erc-channel-buffer): Rudimentary doc string.
1049
10502002-11-09 Alex Schroeder <alex@gnu.org>
1051
1052 * erc-button.el(erc-nick-popup-alist): Made a defcustom.
1053
1054 * erc-button.el(erc-button-disable): New function.
1055 (erc-button-enable): New function, replaces the add-hook calls at top-level.
1056 (erc-button-mode): New minor mode.
1057
10582002-11-08 Alex Schroeder <alex@gnu.org>
1059
1060 * erc-button.el(erc-button-entry): Use erc-button-syntax-table.
1061
1062 * erc.el, erc-stamp.el: Doc changes.
1063
1064 * erc-match.el(erc-match-mode): New function, replacing the
1065 add-hook.
1066 (erc-match-enable): New function.
1067 (erc-match-disable): New function.
1068 (erc-current-nick-highlight-type): Changed from 'nickname to 'nick
1069 to make it consistent with the others.
1070 (erc-match-message): Ditto.
1071
1072 * erc-button.el(erc-button-syntax-table): New variable.
1073 (erc-button-add-buttons): Use it.
1074
10752002-11-06 Mario Lang <mlang@delysid.org>
1076
1077 * erc.el:
1078 1) (bug) ERC pops up a new buffer and window when being messaged
1079 from an ignored person. fixed
1080 2) (misfeature) ERC notices the user in the minibuffer when it
1081 ignores something - this can get very annoying, since the
1082 minibuffer is also visible when not looking at ERC buffers.
1083 Added a customizeable variable for this, the default is nil.
1084 3) (wishlist) There is no IGNORE or UNIGNORE command.
1085 Added.
1086 4) (wishlist) Some IRC clients, notably irssi, allow the user to
1087 ignore "replies" to ignored people. A reply is defined as a
1088 line starting with "nick:", where nick is the nick of an
1089 ignored person. Added that functionaly.
1090 Done by Jorgen Schaefer <forcer@forcix.cx>
1091
10922002-11-02 Alex Schroeder <alex@gnu.org>
1093
1094 * erc.el(erc-connect): set-process-coding-system to raw-text.
1095
10962002-11-01 Brian P Templeton <bpt@tunes.org>
1097
1098 * erc-pcomplete.el, erc-stamp.el, erc-track.el:
1099 Fixed more autoloads
1100
1101 * erc-compat.el: Added autoload for erc-define-minor-mode
1102
11032002-11-01 Mario Lang <mlang@delysid.org>
1104
1105 * erc.el: * (erc-send-command): will break long messages into
1106 a bunch of smaller ones, to prevent them from being truncated by the server.
1107 The patch also axes some trailing whitespace. :-) <resolve>
1108
11092002-10-31 Alex Schroeder <alex@gnu.org>
1110
1111 * erc-pcomplete.el(erc-compat): Require.
1112 (erc-completion-mode): Use erc-define-minor-mode.
1113
1114 * erc-track.el(erc-compat): Require.
1115 (erc-track-modified-channels-mode): Use erc-define-minor-mode.
1116
1117 * erc-stamp.el(erc-compat): Require.
1118 (erc-timestamp-mode): Use erc-define-minor-mode.
1119
1120 * erc-compat.el: New file with the code for erc-define-minor-mode,
1121 erc-encode-coding-string and erc-decode-coding-string. Essentially
1122 all the stuff that cannot be tested for using a simple boundp or
1123 fboundp -- eg. because the number of arguments are wrong.
1124
1125 * erc.el(erc-compat): Require.
1126 (erc-process-coding-system): Moved to erc-compat.el.
1127 (erc-connect): Do not set-process-coding-system.
1128 (encode-coding-string): Compatibility code moved to erc-compat.el.
1129 (decode-coding-string): Compatibility code moved to erc-compat.el.
1130 (erc-encode-coding-string): Compatibility code moved to erc-compat.el.
1131 (erc-decode-coding-string): Compatibility code moved to erc-compat.el.
1132
11332002-10-27 Alex Schroeder <alex@gnu.org>
1134
1135 * erc.el(erc-display-line-1): Removed call to
1136 erc-decode-coding-string.
1137 (erc-parse-line-from-server): Added call to
1138 erc-decode-coding-string before anything gets parsed at all.
1139 (erc-decode-coding-string): Use undecided coding system.
1140
11412002-10-24 Sandra Jean Chua <sacha@free.net.ph>
1142
1143 * erc-button.el, erc.el:
1144 Added LASTLOG command and action for nick-button
1145
11462002-10-22 Sandra Jean Chua <sacha@free.net.ph>
1147
1148 * erc-pcomplete.el:
1149 Fixed nopruning bug, added /MODE channel (mode) [nicks...] completion - mode not completed yet.
1150
11512002-10-16 Sandra Jean Chua <sacha@free.net.ph>
1152
1153 * erc-pcomplete.el:
1154 Fixed 'Hi delysid:' bug in SAY completion after realizing that pcomplete on commands already took care of completing the initial nick:
1155
11562002-10-15 Mario Lang <mlang@delysid.org>
1157
1158 * erc-pcomplete.el: update from sachac
1159
11602002-10-13 Alex Schroeder <alex@gnu.org>
1161
1162 * erc.el(erc-emacs-time-to-erc-time): Catch when tm is nil.
1163
11642002-10-11 Andreas Fuchs <asf@void.at>
1165
1166 * erc.el:
1167 * Fixed `erc-scroll-to-bottom' to scroll to the bottom even when
1168 in the middle of a line. Might also fix the Magic ECHAN Bug[tm]. (-:
1169
11702002-10-11 Mario Lang <mlang@delysid.org>
1171
1172 * erc-nickserv.el: Fixed erc-networks for the opn->freenode change
1173
11742002-10-08 Mario Lang <mlang@delysid.org>
1175
1176 * erc-pcomplete.el:
1177 Make erc-completion-mode work interactively with already joined channel buffers
1178
1179 * erc-chess.el: Add autoload cookies
1180
1181 * erc-notify.el: Add pcomplete support
1182
1183 * erc.el:
1184 Remove autoload statments, remove autoload cookie from erc-mode and erc-info-mode
1185
1186 * erc-fill.el, erc-match.el: add/remove autoload cookies
1187
11882002-10-06 Alex Schroeder <alex@gnu.org>
1189
1190 * erc-pcomplete.el(erc-completion-mode): New global minor mode
1191 with autoload cookie.
1192 (erc-pcomplete-enable): Renamed erc-pcomplete-initialize.
1193 (erc-pcomplete-disable): New function.
1194
1195 * erc-complete.el: Doc changes.
1196
1197 * erc-stamp.el(erc-stamp-enable): Renamed erc-stamp-initialize.
1198 (erc-stamp-disable): Renamed erc-stamp-destroy.
1199 (erc-timestamp-mode): Use new names.
1200
1201 * erc.el: Removed autload for erc-complete and
1202 erc-track-modified-channels-mode -- the autoload cookie should do
1203 that instead.
1204 (erc-input-message): Doc string, removed binding for erc-complete.
1205 (erc-mode-map): Removed binding for erc-complete.
1206
12072002-10-03 Mario Lang <mlang@delysid.org>
1208
1209 * erc-notify.el:
1210 New functions erc-notify-JOIN and erc-notify-QUIT to catch some common cases (warning, untested)
1211
12122002-10-01 Alex Schroeder <alex@gnu.org>
1213
1214 * erc-stamp.el(erc-timestamp-mode): New function. Removed call
1215 to erc-stamp-initialize at the end.
1216
12172002-09-25 Brian P Templeton <bpt@tunes.org>
1218
1219 * erc.el:
1220 Added customizable `erc-process-coding-system' variable.
1221
12222002-09-22 Brian P Templeton <bpt@tunes.org>
1223
1224 * erc-fill.el:
1225 `erc-fill-variable' now does the right thing when `erc-hide-timestamps' is non-nil
1226
12272002-09-21 Mario Lang <mlang@delysid.org>
1228
1229 * erc-fill.el:
1230 patch from Peter Solodov <peter@alcor.concordia.ca> (note, its slightly broken still
1231
12322002-09-05 Mario Lang <mlang@delysid.org>
1233
1234 * erc-pcomplete.el: Added LEAVE as alias for PART
1235
12362002-09-04 Mario Lang <mlang@delysid.org>
1237
1238 * erc-pcomplete.el:
1239 By sachac (good work!) keep up doing such things
1240
12412002-08-31 Mario Lang <mlang@delysid.org>
1242
1243 * erc.el:
1244 A fix for Bug#133267: now you can put (erc-save-buffer-in-logs) on erc-insert-post-hook to save *every* incoming message.
1245
12462002-08-30 Brian P Templeton <bpt@tunes.org>
1247
1248 * erc.el:
1249 Changed default value of erc-common-server-suffixes because of the OPN
1250 name change
1251
12522002-08-28 Mario Lang <mlang@delysid.org>
1253
1254 * erc-stamp.el: Try to reactivate isearch in xemacs
1255
1256 * erc-stamp.el:
1257 fixes issues related to comparative emacsology and a silly bug
1258
12592002-08-27 Mario Lang <mlang@delysid.org>
1260
1261 * erc.el:
1262 New hook erc-send-completed-hook (for robot stuff), changed alexanders email address to reflect reality, little fix to erc-auto-query to get a bit of a speedup
1263
12642002-08-22 Mario Lang <mlang@delysid.org>
1265
1266 * erc-button.el:
1267 Fixed case-fold-search (thanks sachac), now lambda works in erc-button-alist, added wardwiki+google+symvar+rfc+itime regexps from the wiki
1268
12692002-08-19 Mario Lang <mlang@delysid.org>
1270
1271 * erc-button.el:
1272 erc-nick-popup-alist: New variable to make erc-nick-popup configurable
1273
12742002-08-16 Alex Schroeder <alex@gnu.org>
1275
1276 * erc-button.el(erc-recompute-nick-regexp): Fixed regexp.
1277
1278 * erc-button.el(erc-button-buttonize-nicks): Changed custom type
1279 to integer.
1280 (erc-button-add-buttons): Moved button removal code to new
1281 function.
1282 (erc-button-remove-old-buttons): New function.
1283 (erc-button-add-button): Removed use of overlays and used
1284 erc-button-add-face instead.
1285 (erc-button-add-face): New function to merge faces as text
1286 properties. This should be much faster when lots of buttons
1287 appear.
1288 (erc-button-list): New helper function.
1289
1290 * erc.el(erc-display-message): Fixed argument list.
1291 (erc-display-prompt): Reduced calls to length, use start-open
1292 property for XEmacs to prevent a little box of erc-prompt-face at
1293 the end of messages other people send.
1294 (erc-refresh-channel-members): Fix XEmacs calls to split-string,
1295 which may return an empty string at the end of the list. This
1296 would cause hangups in erc-button in re-search-forward loops.
1297 (erc-get-channel-mode-from-keypress): Replaced control codes with
1298 octal escape sequences.
1299
13002002-08-14 Mario Lang <mlang@delysid.org>
1301
1302 * erc-button.el:
1303 Try to be compatible to XEmacs regexp-opt. (Im going to quit this job if I find more of those damn differencies
1304
1305 * debian/README.Debian, debian/scripts/install:
1306 * Added info to README.Debian
1307 * Finished debian/scripts/install
1308
13092002-08-13 Mario Lang <mlang@delysid.org>
1310
1311 * debian/scripts/install: First attempt to fix it
1312
1313 * debian/README.Debian, debian/changelog, debian/scripts/install:
1314 changelog: Changed maintainer and added new entry
1315 README.Debian: Re-explained the byte-compile issue
1316 scripts/install: Exclude erc-bbdb|chess|ibuffer|speedbar from
1317 byte-compiling
1318
1319 * erc-track.el: Added C-c C-SPC in addition to C-c C-@
1320
1321 * erc-notify.el: Little docstring change
1322
13232002-08-09 Mario Lang <mlang@delysid.org>
1324
1325 * erc-stamp.el:
1326 Change one use of set-text-properties to add-text-properties (tnx Lathi)
1327
13282002-08-02 Mario Lang <mlang@delysid.org>
1329
1330 * erc-stamp.el: added erc-timestamp-only-if-changed-flag
1331
13322002-07-22 Mario Lang <mlang@delysid.org>
1333
1334 * erc.el:
1335 Removed timestamp related code and moved into erc-stampe.l
1336
1337 * erc-stamp.el:
1338 Timestamping code moved out of erc.el. Additional, now we can timestamp either on the left or on the right side
1339
13402002-07-16 Mario Lang <mlang@delysid.org>
1341
1342 * erc.el:
1343 * Make ctcp ping return its message in the active buffer, instead of the server buffer
1344 * Corrected minimal typo in catalog
1345 * Added var and variable as alias for /set
1346
13472002-07-08 Mario Lang <mlang@delysid.org>
1348
1349 * erc-track.el:
1350 * New function erc-track-switch-buffer (by resolve)
1351 Bound to C-c C-SPC, enjoy!
1352
13532002-07-08 Gergely Nagy <algernon@debian.org>
1354
1355 * debian/changelog: New snapshot deb
1356
1357 * debian/scripts/install: Rewrote in make.
1358 Does not byte-compile erc-speak.el at all, and excludes erc-track.el too, if
1359 ran for xemacs.
1360
1361 * debian/control: Added dependency on make
1362
1363 * debian/copyright: Updated copyright info
1364
1365 * debian/rules: Use $(wildcard *.el) instead of a hardcoded list
1366
13672002-07-03 Diane Murray <disumu@x3y2z1.net>
1368
1369 * erc.el:
1370 erc-iswitchb now works correctly if erc-modified-channels-alist is non-nil
1371
13722002-07-01 Diane Murray <disumu@x3y2z1.net>
1373
1374 * erc-menu.el:
1375 * changed how we check if we should activate "Track hidden channels" and
1376 whether it should be selected - fixes a bug Xemacs where whole menu bar
1377 does not work if menu is loaded
1378
1379 * erc-menu.el:
1380 * added "Disconnect from server", only selectable if erc-connected is non-nil
1381
1382 * topic is allowed to be set by normal users if channel mode is not +t
1383
1384 * add " ..." after description if arguments needed after selecting menu item
1385
1386 * only allow selecting of menu points needing a channel if current buffer is
1387 a channel buffer - done by testing if channel-members is non-nil
1388
1389 * put erc-match functions in new group "Pals, fools and other keywords"
1390
1391 * erc.el:
1392 * moved definition of erc-show-my-nick to GUI variables section
1393
1394 * erc-connected variable now defined with defvar
1395 now set in channel and query buffers, was only in server buffer before
1396 upon disconnect, set erc-connected to nil in all the server's buffers
1397
1398 * added erc-cmd-GQUIT and its alias erc-cmd-GQ - quit all servers at once
1399
1400 * added interactive function erc-quit-server, bound to C-c C-q
1401
1402 * added erc-server-WALLOPS
1403
1404 * added WALLOPS to english catalog, fixed s461 (was showing message twice)
1405
1406 * typo fixes, spacing change
1407
14082002-06-29 Mario Lang <mlang@delysid.org>
1409
1410 * erc.el: Use pp-to-string in /set (without args)
1411
1412 * erc-netsplit.el:
1413 Make /set anonymous-lign set erc-anonymous-login, also report
1414 which var was set to which val.
1415
14162002-06-28 Diane Murray <disumu@x3y2z1.net>
1417
1418 * erc-menu.el: added "Customize ERC"
1419
14202002-06-25 Mario Lang <mlang@delysid.org>
1421
1422 * erc.el: New variable: erc-use-info-buffers, defaults to nil.
1423 This prevents info-buffers from being created/updated.
1424 Set to t if you use :INFO buffers.
1425 (by rw)
1426 Delete (erc-display-prompt) from reconnect to avoid clutter
1427
14282002-06-23 Diane Murray <disumu@x3y2z1.net>
1429
1430 * erc.el:
1431 erc-get-channel-mode-from-keypress is now bound to C-c C-m
1432 erc-insert-mode-command is taken care of by this function as well
1433
14342002-06-21 Mario Lang <mlang@delysid.org>
1435
1436 * erc-track.el:
1437 Fixed bug where buffer-names suddenly had text-properties.
1438
14392002-06-19 Diane Murray <disumu@x3y2z1.net>
1440
1441 * Makefile: changed erc-auto.el to $(SPECIAL) in make fullclean
1442
1443 * Makefile: remove erc-auto.el on make fullclean
1444
14452002-06-18 Diane Murray <disumu@x3y2z1.net>
1446
1447 * erc-match.el: fixed spelling error
1448
1449 * erc-track.el, erc-match.el: * erc-match.el:
1450 highlight current nickname in its own face (deactivated by default):
1451 - added erc-current-nick-highlight-type, erc-current-nick-face,
1452 erc-current-nick-p
1453
1454 * erc-track.el:
1455 added support for erc-current-nick-face
1456
14572002-06-17 Diane Murray <disumu@x3y2z1.net>
1458
1459 * erc.el: * added beginning suport for 005 numerics:
1460 - added buffer local variable erc-server-parameters
1461 - added erc-server-005, which sets erc-server-parameters if the server has
1462 used this code to show its parameters
1463
14642002-06-16 Diane Murray <disumu@x3y2z1.net>
1465
1466 * erc.el:
1467 * bugfix: when pasting lines with blank lines in between, remove the blank lines
1468 but send the rest
1469
1470 * since we know the command, use it when checking what's in erc-hide-list
1471 added check to erc-server-KICK
1472
1473 * added some blank lines for better readability
1474
14752002-06-16 Alex Schroeder <alex@gnu.org>
1476
1477 * erc-nickserv.el(erc-nickserv-alist): Fixed typo.
1478
14792002-06-15 Alex Schroeder <alex@gnu.org>
1480
1481 * erc-nickserv.el(erc-networks): Added doc string.
1482 (erc-nickserv-alist): Added doc string.
1483
14842002-06-14 Diane Murray <disumu@x3y2z1.net>
1485
1486 * erc-ring.el:
1487 fixed bug so that the prompt and command always get put at the end of the buffer
1488
14892002-06-10 Mario Lang <mlang@delysid.org>
1490
1491 * erc-nickserv.el: Added iip support.
1492 Added :type for erc-nickserv-passwords custom.
1493 Fixed hook usage.
1494
14952002-06-07 Diane Murray <disumu@x3y2z1.net>
1496
1497 * erc-nickserv.el: * added GalaxyNet
1498
1499 * erc-nickserv-alist:
1500 - sorting networks alphabetically
1501 - added two more pieces of information in erc-nickserv-alist:
1502 word to use for identification and whether to use the nickname
1503
1504 * erc-current-network:
1505 - made regex case insensitive, downcase server to match
1506 - uses the new information
1507 - now uses new variable erc-networks instead of doing checking manually
1508
1509 * added variable erc-networks
1510
1511 * fixed some indentation, documentation
1512
15132002-06-07 Mario Lang <mlang@delysid.org>
1514
1515 * erc.el: Fix for kill-buffer hook stuff
1516
15172002-06-06 Mario Lang <mlang@delysid.org>
1518
1519 * erc.el: Added /squery command
1520
15212002-06-06 Diane Murray <disumu@x3y2z1.net>
1522
1523 * erc-menu.el: * made group Channel modes
1524 - moved change mode and invite only mode to here
1525 - added secret, moderated, no external send, topic lock, limit, key
1526
1527 * check that user is in a channel buffer and user is a channel operator
1528 for all op-related actions
1529
1530 * "Identify to nickserv" needs erc-nickserv-identify defined
1531
1532 * added "Show ERC version"
1533
1534 * erc.el:
1535 * added erc-set-channel-limit, erc-set-channel-key, erc-toggle-channel-mode
1536
1537 * added erc-get-channel-mode-from-keypress, which is binded to C-c m
1538 sends the next character which is typed to one of the 3 new functions
1539 - did not remove erc-invite-only-mode and it's key binding in case
1540 people are used to it, although it probably should be removed...
1541
1542 * in erc-server-MODE:
1543 added check if tgt equal to user's nick
1544 removed erc-display-line, only using the erc-display-message
1545
1546 * added s461 to english catalog
1547
1548 * fixed bug where Xemacs would not quit if erc-quit-reason was
1549 set to erc-quit-reason-various and assoc-default was not defined
1550
15512002-06-04 Andreas Fuchs <asf@void.at>
1552
1553 * erc-ezbounce.el, erc-match.el:
1554 * erc-ezbounce.el: Added. Provides support for ezbouncer; automatic login,
1555 session management implemented. I've contacted the author
1556 about stuff in EZBounce's logging.
1557 * erc-match.el: Fixed a stupid mistake where
1558 "*** Your new nick is <foo>" would trigger an error.
1559
15602002-06-04 Diane Murray <disumu@x3y2z1.net>
1561
1562 * erc-nickserv.el, erc.el: * added erc-nickserv.el
1563 * moved nickserv identification variables and functions to the new file
1564 (require 'erc-nickserv) is now necessary for this to work
1565
1566 * erc.el:
1567 * results of /COUNTRY now formatted as notice; errors are ignored,
1568 fixing
1569 bug which made prompt disappear
1570
1571 * added undefined-ctcp error message to english catalog
1572
1573 * changed some (when (not erc-disable-ctcp-replies) to use unless instead
1574 and some if's without else statments to use when or use
1575
1576 * CTCP replies now use erc-display-message, formatted as notices
1577
1578 * added following to english catalog:
1579 - undefined-ctcp
1580 - CTCP-CLIENTINFO, CTCP-ECHO, CTCP-FINGER, CTCP-PAGE, CTCP-PING,
1581 CTCP-SOUND, CTCP-TIME, CTCP-UNKNOWN, CTCP-VERSION
1582 - s303, s305, s306, s353
1583
1584 * split erc-server-305-or-306 into erc-server-305 and erc-server-306
1585
1586 * KICK already had buffer set, using it
1587
1588 * erc.el:
1589 * erc-format-timestamp now only called from erc-display-message and
1590 erc-send-current-line
1591
1592 * all instances of erc-display-line with erc-highlight-error
1593 changed to use erc-display-message
1594
1595 * added following error messages to english catalog:
1596 bad-ping-response, bad-syntax, cannot-find-file, cannot-read-file,
1597 ctcp-request, flood-ctcp-off, flood-strict-mode, no-default-channel,
1598 no-target, variable-not-bound
1599
1600 * added following server related messages to english catalog:
1601 s324, s329, s331, s332, s333, s341, s406, KICK, KICK-you, KICK-by-you, MODE-nick
1602
1603 * ignoring server codes 315, 369
1604
1605 * added erc-server-341, erc-server-406
1606
1607 * channel topic and mode notices displayed in respective channel buffers if they
1608 exist
1609
1610 * erc-server-KICK: display the message before removing this channel so that we
1611 can track the kick
1612
1613 * send parsed to erc-ctcp-query-ACTION-hook so that actions can be checked
1614 by erc-match
1615
1616 * fixed bug where nil was shown if no reason was given by users on /PART
1617
16182002-06-03 Diane Murray <disumu@x3y2z1.net>
1619
1620 * erc-match.el:
1621 * fixed bug where erc-log-matches produced an error when the value of
1622 (erc-default-target) was not a channel
1623 * use erc-format-timestamp, if it's non-nil, for %t in erc-log-match-format
1624
16252002-06-01 Diane Murray <disumu@x3y2z1.net>
1626
1627 * erc-button.el:
1628 * made action case insensitive in erc-nick-popup and added a more descriptive
1629 error message
1630
16312002-05-30 Brian P Templeton <bpt@tunes.org>
1632
1633 * erc.el:
1634 Removed multiple calls of `erc-prompt' in `erc-display-prompt'
1635
16362002-05-29 Mario Lang <mlang@delysid.org>
1637
1638 * erc.el:
1639 First step timestampkiller cleanup. I'm tired, do the rest tomorrow.
1640
1641 * erc.el:
1642 New functionality: Catch channel/server buffer kills through kill-buffer-hook.
1643 Currently, it only does a PART if you kill a channel buffer.
1644
16452002-05-28 Mario Lang <mlang@delysid.org>
1646
1647 * erc.el:
1648 defvar'ed some buffer-local variables to make elint at least a bit more happy.
1649 Moved comments into docstrings.
1650 Changed some instances of member to memq.
1651
1652 * erc-track.el, erc.el:
1653 erc.el: (erc-message-type-member): New function, used to test
1654 for message type. Require erc-parsed text-property.
1655 erc-track.el: erc-track-exclude-types: New variable. Defaults to ("JOIN" "PART") right now for testing, it should eventually set to nil soon again.
1656 (erc-track-modified-channels): Use above fun and var to optionally exclude certain message types from channel tracking.
1657
16582002-05-28 Diane Murray <disumu@x3y2z1.net>
1659
1660 * CREDITS: added myself, vain as it sounds ;)
1661
16622002-05-25 Mario Lang <mlang@delysid.org>
1663
1664 * erc.el: * Some small docstring fixes
1665 * (erc-display-line): Now takes also a process object in the buffer argument.
1666 Used for easy sending to the server buffer.
1667 * Several places: Just pass proc, not (process-buffer proc)
1668
16692002-05-24 Mario Lang <mlang@delysid.org>
1670
1671 * erc.el: Mostly docstring fixes/additions
1672
1673 * erc-netsplit.el: Doc fixes, and a new netjoin-done message.
1674
1675 * erc-fill.el: Doc fixes, erc-fill custom group, autoloads.
1676
1677 * erc-netsplit.el: Fix to erc-netsplit-timer.
1678
1679 * erc-netsplit.el: Fixed a silly typo
1680
1681 * erc-maint.el: is this really necessary?
1682
1683 * erc.el: Added new variable erc-hide-list.
1684 It affects erc globally right now, and is used to hide certain IRC type messages like JOIN and PART.
1685
1686 * Makefile: Doh, I should really test this before checkin :)
1687
1688 * Makefile: Silly cut&paste bug fixed
1689
1690 * erc-list.el: Added autoload cookie
1691
1692 * erc-match.el: Added missing require erc.
1693
1694 * erc-notify.el: Autoload cookies and a -initialize function.
1695
1696 * erc-chess.el: Added autoload cookies
1697
1698 * Makefile: Finally, we have a Makefile.
1699 Primarily used for autoload definition generation right now.
1700
1701 * erc-auto.in: First version.
1702
1703 * erc-track.el: Added autoload cookie
1704
1705 * erc-netsplit.el:
1706 New module, used to autodetect and hide netsplits.
1707 (Untested, no netsplit happened yet :) )
1708
1709 * erc-nets.el: Added some old code I once worked on.
1710 Added autoload cookie
1711
17122002-05-24 Diane Murray <disumu@x3y2z1.net>
1713
1714 * erc-fill.el:
1715 removed reference in documentation to old variable, changed it to the new one
1716
1717 * erc.el:
1718 * added new function erc-connection-established which is called after receiving
1719 end of MOTD (does nothing if it's been called before)
1720
1721 * added new hook erc-after-connect which is called from
1722 erc-connection-established with the arguments server (the announced server)
1723 and nick - which other arguments should be sent??
1724
1725 * added buffer variable erc-connected which is set to t the first time
1726 erc-connection-established is called, set to nil again if we've been
1727 disconnected
1728
1729 * set initial user mode
1730 - added custom variable erc-user-mode which can be a string or a function
1731 which returns a string
1732 - new function erc-set-initial-user-mode gets called from
1733 erc-connection-established
1734
17352002-05-22 Diane Murray <disumu@x3y2z1.net>
1736
1737 * erc.el: fixed bug where prompt was missing after reconnect
1738
17392002-05-21 Diane Murray <disumu@x3y2z1.net>
1740
1741 * erc.el:
1742 in erc-nickserv-identify: if network is unknown, just use "Nickserv"
1743
1744 * erc.el: * fixed some typos
1745
1746 * timestamping
1747 - ctcp request messages and replies now have timestamp
1748 - timestamps in front of error messages now in timestamp face
1749 - added timestamp to more error messages
1750
1751 * ctcp reply messages, server ping message updated
1752
1753 * added variable erc-verbose-server-ping - check this instead of erc-paranoid
1754
1755 * added whowas on no such nick:
1756 - added variable erc-whowas-on-nosuchnick
1757 - in erc-server-401 do WHOWAS if erc-whowas-on-nosuchnick is non-nil
1758
1759 * erc.el: forgot documentaion for erc-nickserv-alist
1760
1761 * erc.el: NickServ identification changed and enhanced:
1762 - erc-nickserv-identify-autodetect now called from erc-server-NOTICE-hook
1763 - now possible to identify automatically without prompt:
1764 - added custom variables erc-prompt-for-nickserv-password and
1765 erc-nickserv-passwords
1766 - added erc-nickserv-alist containing the different networks' nickserv details
1767 - added function erc-current-network to determine the network symbol
1768 - fixed bug where identification on dalnet didn't work, because they now
1769 require NickServ@services.dal.net
1770 now sends to all NickServ with nick@server where possible
1771
17722002-05-17 Diane Murray <disumu@x3y2z1.net>
1773
1774 * erc-fill.el:
1775 * filling with erc-fill-variable now works with custom defined fill width:
1776 - changed erc-fill-column from defvar to defcustom
1777 - in erc-fill-variable: set fill-column to value of erc-fill-column
1778
1779 * erc.el: erc.el:
1780 * fixed bug where topic wasn't being set when chanel name was provided
1781
1782 erc-fill.el:
1783 * filling with erc-fill-variable now works with custom defined fill width:
1784 - changed erc-fill-column from defvar to defcustom
1785 - in erc-fill-variable: set fill-column to value of erc-fill-column
1786
17872002-05-16 John Wiegley <johnw@gnu.org>
1788
1789 * erc.el: whitespace fix
1790
17912002-05-15 Diane Murray <disumu@x3y2z1.net>
1792
1793 * erc.el:
1794 * added explanation of empty string working in erc-quit-reason-various-alist
1795 * removed the text property from erc-send-message, it caused problems
1796 with /SV (as noticed by gbvb on IRC) and is obviously not needed
1797 * when receiving a ctcp query, convert type to uppercase to allow for
1798 "/ctcp nick time" and not just "/ctcp nick TIME"
1799 * timestamp in front of server notices now shown in the timestamp face
1800
18012002-05-13 Diane Murray <disumu@x3y2z1.net>
1802
1803 * erc.el:
1804 - in erc-format-privmessage: `erc-format-timestamp' added to message after
1805 message's text properties are applied so that it doesn't lose its face
1806
1807 - /quit without reason now works when `erc-quit-reason' is set to
1808 `erc-quit-reason-various' and the empty string "" is defined in
1809 `erc-quit-reason-various-alist'
1810
18112002-05-13 Andreas Fuchs <asf@void.at>
1812
1813 * erc-bbdb.el:
1814 * Applied Drewies patch to pop-up on nick changes when -popup-type is 'visible
1815
18162002-05-12 Andreas Fuchs <asf@void.at>
1817
1818 * erc-bbdb.el, erc.el:
1819 * erc-bbdb.el: pop up the buffer on /whois when erc-bbdb-popup-type is 'visible
1820 * erc.el: fix for empty quit reason problem by drewie.
1821
18222002-05-12 Mario Lang <mlang@delysid.org>
1823
1824 * erc.el: disumu nick patch
1825 - added erc-show-my-nick (default t)
1826 if t, show nickname like <nickname>
1827 if nil, only show a > character before the message
1828 - added faces erc-nick-default-face and erc-nick-msg-face
1829 - nicknames (channel, msgs, notices) are now in bold face by default
1830 - the msg face matches the erc-direct-msg-face color
1831
18322002-05-10 Alex Schroeder <alex@gnu.org>
1833
1834 * erc.el(erc-send-pre-hook): Doc change.
1835
1836 * CREDITS: Alexander L. Belikoff is confirmed original author.
1837
18382002-05-10 Mario Lang <mlang@delysid.org>
1839
1840 * erc.el:
1841 timestamp fix by disumutimestamp fix by disumutimestamp fix by disumutimestamp fix by disumutimestamp fix by disumutimestamp fix by disumutimestamp fix by disumutimestamp fix by disumu
1842
18432002-05-09 Mario Lang <mlang@delysid.org>
1844
1845 * erc.el: *** empty log message ***
1846
18472002-05-06 Mario Lang <mlang@delysid.org>
1848
1849 * erc.el:
1850 New var: erc-echo-notices-in-minibuffer-flag. defaults to t.
1851
18522002-05-04 John Wiegley <johnw@gnu.org>
1853
1854 * TODO: *** empty log message ***
1855
18562002-05-03 Alex Schroeder <alex@gnu.org>
1857
1858 * erc.el: Copyright notice, version string updates.
1859
18602002-05-02 Alex Schroeder <alex@gnu.org>
1861
1862 * erc.el: Comment: dme is David Edmondson
1863
18642002-05-01 Alex Schroeder <alex@gnu.org>
1865
1866 * erc.el(erc-warn-about-blank-lines): New option.
1867 (erc-send-current-line): Use it.
1868 (erc-quit-reason-various-alist): New option.
1869 (erc-quit-reason): New option.
1870 (erc-quit-reason-normal): New function.
1871 (erc-quit-reason-zippy): New function.
1872 (erc-quit-reason-various): New function.
1873 (erc-cmd-QUIT): Use them.
1874
18752002-04-30 Alex Schroeder <alex@gnu.org>
1876
1877 * erc.el: Version 2.92
1878
1879 * erc.el(erc-send-modify-hook): Default value is nil.
1880
18812002-04-27 John Wiegley <johnw@gnu.org>
1882
1883 * erc.el:
1884 Don't redisplay the prompt if the ERC buffer is no longer alive.
1885
18862002-04-26 John Wiegley <johnw@gnu.org>
1887
1888 * erc.el:
1889 Don't call `set-buffer' on old-buf unless the buffer is valid. It's
1890 often not when separate frames are being used.
1891
18922002-04-23 Mario Lang <mlang@delysid.org>
1893
1894 * erc-button.el: fixed up erc-nick-regexp
1895
18962002-04-22 Brian P Templeton <bpt@tunes.org>
1897
1898 * erc.el:
1899 `erc-prompt' may now be a function that returns a string (which is
1900 used as the prompt). I don't use Customize but I think customization
1901 of it may be broken if it's not a string.
1902
1903 There is a new `erc-prompt' function that returns the prompt as a
1904 string (e.g., returning either the result of `(funcall erc-prompt)' or
1905 `erc-prompt').
1906
1907 This allows for dynamic prompts, such as a LispWorks-like prompt, or
1908 one containing simply the current channel name. It was requested by
1909 Mojo Nichols (nick michols) in #emacs today, 21-Apr-2002; cf. the
1910 #emacs logs at <URL:http://www.tunes.org/~nef/logs/emacs/02.04.21.
1911
19122002-04-17 Mario Lang <mlang@delysid.org>
1913
1914 * erc.el:
1915 fix erc-send-current-line to work on empty lines again (without sending the prompt)
1916 Fix C-c C-t to not include the nick/time info
1917 (both from antifuchs)
1918
1919 * erc-complete.el: Fix for xemacs elt behaviour
1920
19212002-04-17 John Wiegley <johnw@gnu.org>
1922
1923 * erc-chess.el:
1924 Added a missing arg in a call to erc-chess-handler.
1925
19262002-04-15 John Wiegley <johnw@gnu.org>
1927
1928 * erc-chess.el: *** empty log message ***
1929
19302002-04-14 John Wiegley <johnw@gnu.org>
1931
1932 * erc-chess.el: *** empty log message ***
1933
19342002-04-12 John Wiegley <johnw@gnu.org>
1935
1936 * erc-chess.el: *** empty log message ***
1937
1938 * erc-chess.el: bug fixes
1939
1940 * erc-chess.el: *** empty log message ***
1941
19422002-04-12 Mario Lang <mlang@delysid.org>
1943
1944 * erc-chess.el: change order.
1945
1946 * erc-chess.el: more fixing.
1947
1948 Now, the 'match question works. It sends an accept back.
1949 But display popup doesnt work..
1950
1951 * erc-chess.el: fixup (still far from working)
1952
19532002-04-11 Mario Lang <mlang@delysid.org>
1954
1955 * erc.el:
1956 * Added :options entry for erc-mode-hook (erc-add-scroll-to-bottom)
1957
19582002-04-11 John Wiegley <johnw@gnu.org>
1959
1960 * erc.el: remove trailing \n from any sent text
1961
1962 * servers.pl, erc-bbdb.el, erc-button.el, erc-chess.el,
1963 erc-complete.el, erc-fill.el, erc-ibuffer.el, erc-list.el,
1964 erc-match.el, erc-menu.el, erc-nets.el, erc-replace.el,
1965 erc-speak.el, erc-speedbar.el, erc-track.el, erc.el:
1966 clean whitespace
1967
1968 * erc.el: Replaced erc-scroll-to-bottom.
1969
19702002-04-11 Mario Lang <mlang@delysid.org>
1971
1972 * erc-track.el:
1973 try to fix behaviour when used with different frames.
1974
19752002-04-09 Mario Lang <mlang@delysid.org>
1976
1977 * erc-chess.el:
1978 fixup release, far from ready for real usage, but it appears to work.
1979
1980 * erc.el:
1981 speed improvments based on elp-instrument-package RET erc- RET results
1982
1983 * erc-chess.el: initial version.
1984 please test it
1985 Get chess.el from johnw's cvs:
1986 cvs -d:pserver:anonymous@alice.dynodns.net:/usr/local/cvsroot login
1987 cvs -d:pserver:anonymous@alice.dynodns.net:/usr/local/cvsroot co chess
1988
1989 (as usual, blank password)
1990
1991 Add the resulting dir to your load-path and reqire erc-chess.
1992
1993 Usage: Just do /chess nickname
1994 The remote end much use erc, as no other irc client I know of supports this ...
1995
1996 See erc-chess-default-display and maybe set it to chess-images or chess-ics1 if you prefer those over chess-plain.
1997 Also, see erc-chess-user-full-name to set the name you use in chess games.
1998
19992002-04-04 Mario Lang <mlang@delysid.org>
2000
2001 * erc.el: New hackery latenightwise
2002
2003 * erc.el: upupadowndowncase
2004
20052002-04-04 Gergely Nagy <algernon@debian.org>
2006
2007 * debian/changelog: Updated for the new snapshot
2008
2009 * debian/rules: Install README.Debian into the package
2010
2011 * debian/README.Debian: Initial check-in
2012
20132002-04-04 Mario Lang <mlang@delysid.org>
2014
2015 * erc.el:
2016 Fixed that /me in query buffers ended up in server buffer
2017
2018 * erc.el: * Implemented joining +k channels
2019
20202002-03-14 Mario Lang <mlang@delysid.org>
2021
2022 * erc.el: New utility function: erc-channel-list
2023 minor fix to erc-get-buffer. hopefully that helps shapr
2024
20252002-03-12 Mario Lang <mlang@delysid.org>
2026
2027 * erc.el:
2028 New /command: /QUOTE for sending directly to the IRC server
2029 Removed erc-fill from erc-insert-modify-hook. To activate filling, simply customize that var.
2030
20312002-03-09 Brian P Templeton <bpt@tunes.org>
2032
2033 * CREDITS: *** empty log message ***
2034
20352002-03-09 Mario Lang <mlang@delysid.org>
2036
2037 * erc-complete.el:
2038 New variable: erc-nick-completion-ignore-case. Defaults to t.
2039
2040 * erc-track.el:
2041 * erc-track-shorten-name-function can now be set to nil to avoid treating of channel names at all.
2042
20432002-03-06 Gergely Nagy <algernon@debian.org>
2044
2045 * debian/changelog, debian/rules: update to new snapshot
2046
20472002-03-06 Mario Lang <mlang@delysid.org>
2048
2049 * erc.el:
2050 Fixed nasty bug which prevented channel limit from correctly display/handling
2051
2052 * erc-track.el: Made shortening code highly customizable.
2053 Now, there is the variable erc-track-shorten-function which holds
2054 a function which gets called with one argument, CHANNEL-NAMES, which is a list
2055 of strings of the channel names.
2056 It needs to return a list of strings of the same length with the modified values...
2057
2058 * erc-track.el:
2059 Added erc-track-shorten-aggressively, default to nil
2060 if it is set to t, erc will shorten a bit more.
2061 if nil, erc will shorten the name only if it would get shorter than just
2062 one char...
2063
2064 * erc-speak.el: added iirc to the abbreviation expansion list.
2065
2066 * erc-track.el:
2067 Added customization variable: erc-track-use-faces. defaults to t.
2068
2069 * erc-track.el: *** empty log message ***
2070
2071 * erc-track.el:
2072 experimental: Added face support to mode-line channel activity tracker.
2073 Currently we use the faces used for indicating in the buffer (erc-pal-face for channels with pal acitivity...)
2074
20752002-03-05 Mario Lang <mlang@delysid.org>
2076
2077 * erc-complete.el: * added docfixes (thanks ore)
2078
2079 * erc-track.el: Fixed channel-name reduction.
2080 thanks again alex.
2081 Renamed the vars to erc-track-opt-start and erc-track-opt-cutoff.
2082
2083 * erc.el: fixed another silly error
2084
2085 * erc-track.el: Implemented channel name shortening.
2086 Vars erc-track-cutoff says: all channel names longer than this will be shortened.
2087 Var erc-track-minimum-channel-length says: dont make names shorten than this.
2088 (Thanks go out to kensanata for the nice unique-substrings utility function).
2089
2090 * erc.el 2002-07-15T00:01:34Z!raeburn@raeburn.org: silly typo corrected
2091
2092 * erc.el: * erc.el: * New varialbe: erc-common-server-name-suffixes
2093 This alist can be used to change the server names displayed in mode-line
2094 to a shorter version..
2095 * New function: erc-shorten-server-name (uses var above)
2096 * Changed erc-prepare-mode-line to use erc-shorten-server-name.
2097
20982002-02-25 Mario Lang <mlang@delysid.org>
2099
2100 * erc.el:
2101 CTCP handling rewritten. Seems to work. please test and report probs.
2102
21032002-02-24 Mario Lang <mlang@delysid.org>
2104
2105 * erc.el:
2106 Fixed emacs20 backward compatibility (new defun/alias: erc-propertize)
2107
21082002-02-22 Mario Lang <mlang@delysid.org>
2109
2110 * erc-button.el: *** empty log message ***
2111
21122002-02-21 Mario Lang <mlang@delysid.org>
2113
2114 * erc-button.el, erc.el:
2115 minor fixup related to read-only prompts and command renaming.
2116
21172002-02-21 Andreas Fuchs <asf@void.at>
2118
2119 * erc.el: * modify `erc-remove-text-properties-region' to work.
2120 Could even be a little faster now. (-:
2121
21222002-02-21 Mario Lang <mlang@delysid.org>
2123
2124 * erc-ring.el:
2125 fixed erc-replace-command to behave right when text is read-only.
2126 Also, use erc-insert-marker and (point-max) now.
2127
2128 * erc.el: * Made erc-prompt read-only
2129 * new function: erc-make-read-only. Can be used on erc-insert-post-hook and erc-send-post-hook to ensure read-only buffer text too
2130
21312002-02-19 Mario Lang <mlang@delysid.org>
2132
2133 * erc-list.el: added comment to docstring
2134
2135 * erc-speak.el: minor updates, use erc-nick-regexp now
2136
2137 * erc.el:
2138 ensure that erc-timer-hook is called inside the server-buffer.
2139
21402002-02-19 Andreas Fuchs <asf@void.at>
2141
2142 * erc-match.el:
2143 * Probably fixed the "number-char-or-marker-p: nil" bug.
2144
21452002-02-19 Mario Lang <mlang@delysid.org>
2146
2147 * erc-notify.el: Initial release.
2148
2149 * erc.el: added #303 handling
2150 moved timer and added an arg (erc-current-time)
2151
2152 * erc-list.el, erc.el:
2153 slightly changed the erc-once-with-server-event macro
2154
2155 * erc-button.el: erc-button-alist: doc fix and custom type fix
2156
21572002-02-18 Mario Lang <mlang@delysid.org>
2158
2159 * erc-list.el, erc.el: new macro: erc-once-with-server-event
2160 erc-list.el: use it
2161
2162 * erc-match.el:
2163 Minor fix related to hook call method change (-until-seccess now)
2164
2165 * erc.el: fixed ctcp behaviour abit (with auto-query on)
2166
2167 * erc-list.el: ChanList mode.
2168 Load it, and type M-x erc-chanlist RET
2169 Demonstrates how the new hook system can be nicely used.
2170
2171 * erc.el:
2172 new hook: erc-default-server-hook. This one gets called if we dont have anything defined for a certain IRC server message.
2173 New function: erc-default-server-handler. (used by above hook).
2174 New function: erc-debug-missing-hooks: Used by above hook to save a list of unimplemented server messages.
2175 New function: erc-server-buffer, erc-server-buffer-p.
2176 Various places: use it.
2177 Minor fixup.
2178
2179 * erc-button.el: fix regexp to not buttonize ~user@host hostnames
2180
21812002-02-17 Mario Lang <mlang@delysid.org>
2182
2183 * erc-complete.el, erc.el: Eliminated erc-command-table
2184 Upcased the command defuns (erc-cmd-join is now erc-cmd-JOIN)
2185 Fixed erc-complete to not require erc-command-table.
2186 Implemented erc-cmd-HELP
2187 (You have to try that, its tooo coool!)
2188 e.g. /help auto-q
2189 fixed autoloads for erc-add-pal and so on to be interactive.
2190
21912002-02-17 Andreas Fuchs <asf@void.at>
2192
2193 * erc-match.el:
2194 * Fix unfunctional code in `erc-get-parsed-vector-type'.
2195
2196 * erc-bbdb.el, erc-button.el, erc-match.el, erc.el:
2197 * Be careful: MANY changes ahead. I won't go into too much details.
2198
2199 * erc.el, new file erc-match.el: split out all pattern-matching code.
2200 * erc.el: removed all defcusts for erc-{...}-highlight-props. They are
2201 quite useless, anyway.
2202 * moved erc-add-entry-to-list and -remove- over to erc-match. changed
2203 their arg list.
2204 * erc.el: add autoloads for erc-{add,delete}-{keyword,pal,fool,dangerous-host}
2205 * erc.el: erc-server-PRIVMSG-or-NOTICE:
2206 - remove all the highlighting crap
2207 - add a (when (eq s nil) ...) so that untreated CTCP messages don't
2208 get misdisplayed.
2209 * erc.el: erc-mark-message: removed this function, it's useless
2210 * erc.el: minor bugfixes.
2211
2212 * erc-match.el: first checkin. This file now contains all the pattern
2213 matching stuff. there is now another defcust group, erc-match,
2214 containing all match related stuff (erc-keywords, ...)
2215 * erc-match.el: added functionality to log matching lines. Quite
2216 customizable, check out the docstring of defun erc-log-matches
2217 * erc-match.el: added functionality to make foolish messages
2218 invisible/intangible. This could replace erc-ignore-list
2219 sometime. it's more powerful right now, anyway.
2220 * erc-match.el erc-text-matched-hook: new hook. run when Text matches
2221 anything (pal, fool, etc.).
2222
2223 * erc-button.el: Make nick buttonization customizable.
2224 * erc-button.el: Give nick buttonization a lower priority so that it
2225 does not break url buttons.
2226
2227 * erc-bbdb.el: Add \n to the separators by which we split nicknames.
2228
22292002-02-17 Mario Lang <mlang@delysid.org>
2230
2231 * TODO: Added item
2232
22332002-02-17 Brian P Templeton <bpt@tunes.org>
2234
2235 * CREDITS, erc.el: Added invisible timestamp support.
2236
22372002-02-16 Gergely Nagy <algernon@debian.org>
2238
2239 * debian/changelog, debian/rules, debian/scripts/install:
2240 updated to new snapshot
2241
22422002-02-16 Mario Lang <mlang@delysid.org>
2243
2244 * erc.el:
2245 Fixed channel limit format overflow in mode-line display.
2246 (Having to use floats if integers are to large is quite strange, isn't it?)
2247
2248 * TODO: TODO list created.
2249 Add comments and expand it.
2250
2251 * erc.el:
2252 Fixed bug in query buffer handling (only happend in mixed-case situations)
2253
2254 * erc.el: shapr checkdoc patch #1
2255 massive docfixes! yay, keep going!
2256
22572002-02-15 Mario Lang <mlang@delysid.org>
2258
2259 * erc.el: various other fixes
2260 make s301 a catalog entry
2261
22622002-02-15 Andreas Fuchs <asf@void.at>
2263
2264 * erc.el: * erc-server-NICK and erc-server-INVITE: fixed to use
2265 `erc-display-message'. These I missed in the first checkin. I
2266 didn't say it in the last log message, but please test these.
2267
2268 * erc-fill.el, erc.el:
2269 * erc.el: updated many functions to use `erc-display-message'. Now, we
2270 should go for getting highlighting out of
2271 erc-server-PRIVMSG-or-NOTICE. The part I want to attack has been
2272 marked.
2273 * erc-fill.el: updated static filling to leave the erc-parsed property alone.
2274
22752002-02-15 Mario Lang <mlang@delysid.org>
2276
2277 * erc.el:
2278 first step, new function: erc-display-message
2279
2280 * erc.el: added numreply 379 and 405.
2281
2282 * erc.el: stupid typo fixed
2283
2284 * erc.el:
2285 Finally renamed erc-frame-dedicated-p to erc-frame-dedicated-flag
2286 Removed usage of erc-interpret-controls from info buffer drawing (major speedup)
2287 Other speedups based on the results from elp.
2288 ERC is now about 300%-500% faster in some situations with very full channels!!!!!
2289
22902002-02-14 Andreas Fuchs <asf@void.at>
2291
2292 * erc.el:
2293 * erc-downcase now downcases {}|^ with []\~ -- 'stolen' from zenirc.
2294 * various checkdoc fixes. Just the upper third of the file, but that
2295 should help a little, too. (-: Again, if you have any writing
2296 skills, take out that dusty keyboard and tap it to the beat of M-x
2297 checkdoc!
2298
22992002-02-14 Gergely Nagy <algernon@debian.org>
2300
2301 * erc.el(erc-format-privmessage):
2302 fix it, so timestamp-coloring works again (patch from antifuchs)
2303
23042002-02-14 Mario Lang <mlang@delysid.org>
2305
2306 * erc.el: Many fixes based on M-x checkdoc RET.
2307 If you have write access, and some english knowledge, help document erc too!
2308 M-x checkdoc RET, and follow the instructions.
2309
2310 * erc-button.el, erc-ibuffer.el: minor fixes
2311
2312 * erc.el: Use nreverse instead of reverse.
2313 Use eq instead of equal where possible.
2314 Rewrote erc-get-buffer to not use find-if (find-if does very deep function-call nesting, which isnt good ina defun which is called so often)
2315
23162002-02-13 Mario Lang <mlang@delysid.org>
2317
2318 * erc-button.el, erc.el:
2319 In erc.el, new hook: erc-channel-members-changed-hook.
2320 erc-button.el: Now highlight all nicknames. uses regexp-opt.
2321
23222002-02-04 Mario Lang <mlang@delysid.org>
2323
2324 * erc-nets.el:
2325 Database of irc networks. Use erc-server-select to interactively select one.
2326
2327 * erc.el: * erc-format-nick-function: New variable.
2328 * (erc-format-nick): The default for above var. Just return the nick.
2329 * (erc-format-@nick): Prefix NICK with @ or + if OP or VOICE.
2330 * Removed erc-track-modified-channels related code and moved into erc-tracke.l
2331 Its auto-loaded now
2332
2333 * erc-track.el: Split code from erc.el
2334
23352002-02-01 Mario Lang <mlang@delysid.org>
2336
2337 * erc-ibuffer.el:
2338 * erc-target now uses erc-port-to-string
2339
2340 * servers.pl:
2341 Script to convert mircs servers.ini to a elisp salist kind of thing.
2342 (development tool, it doesnt help you much as a user)
2343
2344 * erc.el:
2345 * erc-display-line-buffer: renamed to erc-display-line-1
2346 * erc-port-equal: New function.
2347 * erc-normalize-port: Used by erc-port-equal
2348 * minor docstring fixes
2349
23502002-02-01 Andreas Fuchs <asf@void.at>
2351
2352 * erc.el:
2353 * erc-already-logged-in-p: compare ports is more robust now.
2354
2355 * erc-button.el: * Add buttonization to erc-send-modify-hook, too
2356
23572002-01-31 Mario Lang <mlang@delysid.org>
2358
2359 * erc.el:
2360 Use insert-before-markers instead of insert in erc-display-line-buffer
2361 This fixed point@column 0 problem and gives us some speedup! yay
2362
2363 * erc-ibuffer.el, erc.el: minor fixes
2364
2365 * erc.el:
2366 * (erc-line-beginning-position): Renamed to erc-beg-of-input-line.
2367 * (erc-line-end-position): Renamed to erc-end-of-input-line.
2368 * erc-multiline-input-p: Variable removed.
2369
2370 * erc.el:
2371 Minor docstring fixes (using M-x checkdoc-current-buffer)
2372 If you find time, and you are native english speaker, do that too!!
2373
2374 * erc.el: fixed macro-invokation
2375
23762002-01-31 Andreas Fuchs <asf@void.at>
2377
2378 * erc.el: * erc-with-all-buffers-of-server: use erc-list-buffers
2379 * erc-process-away, erc-{save,kill}-query-buffers: use it.
2380 * erc-cmd-away-all: new command. Set away/back on all servers.
2381
2382 * erc.el:
2383 * Fix last multiline bug in erc-send-distinguish-noncommands.
2384
23852002-01-31 Mario Lang <mlang@delysid.org>
2386
2387 * erc-ibuffer.el, erc.el: minor fixes
2388
23892002-01-30 Mario Lang <mlang@delysid.org>
2390
2391 * erc-ibuffer.el, erc-menu.el, erc-speak.el, erc.el:
2392 Renamed erc-track-modified-channels-minor-mode to erc-track-modified-channels-mode (at least, its a bit shorter)
2393 Added docstring to erc-server-hooks (through the macro)
2394 Minor docfix in obsolete hook
2395
23962002-01-30 Andreas Fuchs <asf@void.at>
2397
2398 * erc.el:
2399 * erc-send-current-line: fix behaviour where buffer changes.
2400 * erc-mark-message: fix stupid face bug. highlighting of pals should work now.
2401
2402 * erc-ring.el, erc.el:
2403 * new hooks: erc-send-pre-hook, erc-send-modify-hook, erc-send-post-hook
2404 * erc-send-this: new variable
2405 * erc-noncommands-list: new constant.
2406 * erc-send-distinguish-noncommands: use it. (First filter function for sending! yay!)
2407 * erc-send-current-line: nearly completely rewritten.
2408 - now handles multiline input. (yay!)
2409 - now uses the three hooks from above.
2410 * erc-process-line: new arg, no-command: don't process this line as a command.
2411
24122002-01-30 Mario Lang <mlang@delysid.org>
2413
2414 * erc-bbdb.el, erc-button.el, erc-speak.el, erc.el:
2415 hook handling rewrite phase 1.
2416
24172002-01-30 Andreas Fuchs <asf@void.at>
2418
2419 * erc.el: * Rework erc-server-PRIVMSG-or-NOTICE
2420 * New function: erc-is-message-ctcp-p
2421 * New function: erc-format-privmessage
2422 * New function: erc-mark-message
2423 * erc-server-PRIVMSG-or-NOTICE: use them.
2424
24252002-01-30 Mario Lang <mlang@delysid.org>
2426
2427 * CREDITS, HISTORY:
2428 Initial checkin.
2429
24302002-01-29 Andreas Fuchs <asf@void.at>
2431
2432 * erc.el: * erc-put-text-properties: make OBJECT optional
2433 * erc-put-text-property: same
2434 * erc-server-PRIVMSG-or-NOTICE: use them.
2435 * Make erc-display-line-buffer: add the "\n" even when the string would be invisible.
2436 * same: make the \n invisible, too (:
2437
24382002-01-29 Mario Lang <mlang@delysid.org>
2439
2440 * erc-ibuffer.el, erc.el:
2441 Rewrote channel tracking using window-configuration-change-hook instead of defadvices.
2442
24432002-01-28 Andreas Fuchs <asf@void.at>
2444
2445 * erc-fill.el, erc.el:
2446 * Macro define-erc-highlight-customization: Ease up defining
2447 erc-{fool,pal,..}-highlight-props defcusts.
2448 * defcusts:
2449 - erc-fool-highlight-props
2450 - erc-pal-highlight-props
2451 - erc-dangerous-host-highlight-props
2452 - erc-keyword-highlight-props
2453
2454 Customizable to either nil or "Hide message".
2455 * erc-string-invisible-p: check for invisible chars in string
2456 * erc-display-line-buffer: use it.
2457 * erc-put-text-properties: put a list of props into a piece of text.
2458 * erc-server-PRIVMSG-or-NOTICE: use it; set appropriate
2459 highlight-props for entire incoming message. This set of changes
2460 allows you to e.g. auto-ignore fools.
2461
24622002-01-28 Mario Lang <mlang@delysid.org>
2463
2464 * erc-ibuffer.el:
2465 Added highlight detection support to the Mark column.
2466 Now p, k, f, and d indicate pal, keyword, fool and dangerous-host related activity.
2467
2468 * erc.el:
2469 Highlight tracking finished. All necessary info should now be in erc-modified-channels.
2470
2471 * erc.el, erc-ibuffer.el, erc-speedbar.el:
2472 Added highlight tracking to track-modified-channels
2473 no display code yet, the info is just kept in erc-modified-channels
2474 Added erc-modified column to ibuffer
2475 speedbar update
2476
2477 * erc-ibuffer.el: Added erc-members column
2478
2479 * erc-ibuffer.el: *** empty log message ***
2480
24812002-01-28 Andreas Fuchs <asf@void.at>
2482
2483 * erc-bbdb.el:
2484 * Fix a slight typo. The hook function should be called in
2485 erc-server-376-hook (-:
2486
24872002-01-28 Mario Lang <mlang@delysid.org>
2488
2489 * erc-ibuffer.el: *** empty log message ***
2490
24912002-01-27 Mario Lang <mlang@delysid.org>
2492
2493 * erc-ibuffer.el: Fixup, it sort of works now. Try it
2494
2495 * erc-ibuffer.el: Initial version
2496
24972002-01-26 Mario Lang <mlang@delysid.org>
2498
2499 * erc.el: *** empty log message ***
2500
25012002-01-25 Andreas Fuchs <asf@void.at>
2502
2503 * erc-bbdb.el: * fix two bad things:
2504 - fix the "proc trick": pass proc as an arg through
2505 ...-insinuate-... to ...-show-entry
2506 - hook highlighting into the 376 hook. This one is bound to get
2507 called (-:
2508 * We now only append to hooks only.
2509 * Highlighting of changing records gets updated automatically.
2510
25112002-01-25 Mario Lang <mlang@delysid.org>
2512
2513 * erc.el: *** empty log message ***
2514
25152002-01-25 Andreas Fuchs <asf@void.at>
2516
2517 * erc-bbdb.el: * nearly complete rewrite of erc-bbdb:
2518 - Removed code duplication in erc-bbdb-NICK and -JOIN.
2519 - Made erc-bbdb-show-entry more general and intelligent.
2520 - erc-bbdb-insinuate-entry is now erc-bbdb-insinuate-and-show-entry
2521 (note the different arglist!):
2522 - erc-search-name-and-create now creates "John Doe" users if name
2523 is not specified.
2524 - No sign of "mail" anywhere anymore. It's all finger-host. (-:
2525 - erc-bbdb-popup-p is now called erc-bbdb-popup-type.
2526 - New customize values:
2527 . erc-bbdb-irc-channel-field channel field name
2528 . erc-bbdb-irc-highlight-field (see below)
2529 . erc-bbdb-auto-create-on-nick-p auto-create record on join
2530
2531 * Highlighting based on BBDB is now here! Specify which type of
2532 highlighting a person in the BBDB (whose nick you know) and have
2533 fun! Read help to erc-bbdb-init-highlighting for details. Changes:
2534 - new function erc-bbdb-init-highlighting: gets called on server
2535 connect.
2536 - new function erc-bbdb-highlight-record: highlights a person's
2537 nick names.
2538
25392002-01-24 Andreas Fuchs <asf@void.at>
2540
2541 * erc-button.el:
2542 * Fix the erc-button-alist regexp for EmacsWiki stuff. delYsid's version
2543 is better (-:
2544
2545 * erc-button.el: * Added an Ewiki: specifier to the url-regexp.
2546 <nickname> EmacsWiki: EmacsIRCClient tells you <bla>
2547 should highlight "EmacsWiki: EmacsIRCClient" and allow you to
2548 browse to the wiki when the button is activated.
2549 * new custom: erc-emacswiki-url.
2550 * new function: erc-browse-emacswiki: use it.
2551
25522002-01-23 Mario Lang <mlang@delysid.org>
2553
2554 * erc-bbdb.el:
2555 erc-bbdb-NICK: Added regexp-quote around fingerhost search.
2556
25572002-01-10 Andreas Fuchs <asf@void.at>
2558
2559 * erc.el:
2560 * Channel saving/killing on quit from server implemented:
2561 - defcust erc-save-queries-on-quit: Save server's channel buffers on quitting from server
2562 - defcust erc-kill-queries-on-quit: Kill server's channel buffers on quitting from server
2563 - Macro erc-with-all-buffers-of-server: Run a form inside all the server's query buffers
2564 - Functions erc-{kill,save}-query-buffers: use it.
2565 * Added indent-tabs-mode: t to Local Variables section.
2566
25672002-01-07 Andreas Fuchs <asf@void.at>
2568
2569 * erc-replace.el: * fix stupid documentation errors.
2570
25712002-01-07 Mario Lang <mlang@delysid.org>
2572
2573 * erc.el:
2574 * (toplevel): Revert previous change. This resulted ina recursive load...
2575 You have to put (require 'erc-button) into your .emacs for now
2576
25772002-01-05 Mario Lang <mlang@delysid.org>
2578
2579 * erc.el:
2580 * Added require for erc-button. This is devel. so I need testers :)
2581
2582 * erc-button.el: * Added proper file headers (GPL).
2583
25842002-01-04 Mario Lang <mlang@delysid.org>
2585
2586 * erc-button.el: * erc-button-alist: Added entry for finger
2587
2588 * erc-button.el: * Removed bogus usage of :button-keymap.
2589 P
2590 Does anyone know what this was supposed to do anyway?
2591
2592 * erc-button.el: * Initial version.
2593 * This module allows a way of buttonizing text in IRC buffers.
2594 Default it is used for URLs, but other things could be added.
2595 see if you can find another use, erc-button-alist
2596
2597 Copyright (C) 2002 Free Software Foundation, Inc.
2598 Copying and distribution of this file, with or without modification,
2599 are permitted provided the copyright notice and this notice are preserved.
2600
2601;; arch-tag: a6779d5e-99fa-442b-98cf-90e73eb2c272
diff --git a/lisp/erc/ChangeLog.2003 b/lisp/erc/ChangeLog.2003
new file mode 100644
index 00000000000..d67393c2884
--- /dev/null
+++ b/lisp/erc/ChangeLog.2003
@@ -0,0 +1,2145 @@
12003-12-30 Francis Litterio <franl@users.sourceforge.net>
2
3 * erc.el(erc-cmd-HELP):
4 Changed to prefer giving help for erc-cmd-* functions over
5 similarly-named Elisp functions (e.g., erc-cmd-LIST vs. list).
6
72003-12-28 Francis Litterio <franl@users.sourceforge.net>
8
9 * erc.el(erc-query-buffer-p): Added this function.
10
112003-12-28 Jorgen Schaefer <forcer@users.sourceforge.net>
12
13 * erc.el(erc-cmd-SV): Use erc-emacs-build-time.
14
15 * erc-compat.el: erc-emacs-build-time: New variable.
16
17 * erc.el(erc-cmd-SAY):
18 Reintroduced the feature where the spaces between
19 "/SAY" and the rest of the line were being sent with the message.
20
212003-12-28 Francis Litterio <franl@users.sourceforge.net>
22
23 * erc.el(erc-server-buffer-p):
24 Fixed a bug where this function sometimes would return
25 nil when it should return t.
26
272003-12-27 Francis Litterio <franl@users.sourceforge.net>
28
29 * erc.el(erc-generate-new-buffer-name):
30 Really fixed a bug where ERC would reuse
31 a connected server buffer when erc-reuse-buffers is non-nil.
32 (erc-cmd-JOIN): Now we tell the user when he attempts to join the same
33 channel twice on the same server.
34
35 * erc.el(erc-generate-new-buffer-name):
36 Fixed a bug where ERC would reuse a connected server buffer when erc-reuse-buffers is non-nil.
37
38 * erc.el(erc-cmd-SAY):
39 Fixed a bug where the spaces between "/SAY" and the rest of the
40 line were being sent with the message.
41
42 * erc-list.el: Fixed another typo.
43
44 * erc-list.el: Fixed a typo.
45
46 * erc-list.el:
47 Added text to the top of the channel list buffer describing the keybinding for
48 function erc-chanlist-join-channel.
49
50 * erc-list.el: Minor appearance changes. No functional change.
51
52 * erc-list.el:
53 Implemented function erc-chanlist-join-channel. Added variable
54 erc-chanlist-channel-line-regexp. Got rid of function
55 erc-chanlist-pre-command-hook. Changed the logic for how channel lines are
56 highlighted.
57
582003-12-26 Francis Litterio <franl@users.sourceforge.net>
59
60 * erc-list.el:
61 Removed a bunch of unused code. No semantic change.
62
63 * erc-list.el: Added lots of functionality.
64
652003-12-15 Mario Lang <mlang@delysid.org>
66
67 * erc-track.el, erc.el:
68 New custom type erc-message-type, use it in erc-hide-list and erc-track-exclude-types
69
702003-12-14 Alex Schroeder <alex@gnu.org>
71
72 * erc-track.el(track-when-inactive): New module.
73 (erc-track-visibility): New option.
74 (erc-buffer-activity): New variable.
75 (erc-buffer-activity-timeout): New variable.
76 (erc-user-is-active): New function.
77 (erc-buffer-visible): New function.
78 (erc-modified-channels-update): Replace get-buffer-window call
79 with call to erc-buffer-visible.
80 (erc-track-modified-channels): Ditto.
81
822003-12-14 Lawrence Mitchell <wence@gmx.li>
83
84 * erc-track.el(erc-modified-channels-update):
85 Force update of modeline. Makes sure
86 that the tracked channels disappear in other buffers too.
87
882003-12-06 Lawrence Mitchell <wence@gmx.li>
89
90 * erc.el(define-erc-module):
91 New optional argument LOCAL-P. If non-nil, then
92 mode will be created as buffer-local rather than a global mode.
93 (erc-cmd-CTCP): Fix indentation from last commit.
94
95 * erc-compat.el(erc-define-minor-mode):
96 Deal with :global and :group keywords.
97
98 * erc-nickserv.el(erc-current-network):
99 Make server regex more permissive.
100
101 * erc.el(erc-cmd-CTCP):
102 Don't add a space to end of command when ARGS are
103 empty. This fixes a bug whereby requests of the form "VERSION " were
104 being sent, and ignored.
105
1062003-11-27 Lawrence Mitchell <wence@gmx.li>
107
108 * erc-log.el: From Adrian Aichner <adrian@xemacs.org>
109 * erc-log.el (erc-log-file-coding-system): Use 'binary
110 coding-system under XEmacs (instead of 'emacs-mule).
111 * erc-log.el (erc-w32-invalid-file-characters): Removed as no
112 longer needed.
113 * erc-log.el (erc-generate-log-file-name-long): Use
114 `convert-standard-filename', which exists in XEmacs too.
115
1162003-11-16 Mario Lang <mlang@delysid.org>
117
118 * erc-identd.el: Code provided by johnw, thanks!
119
1202003-11-09 Lawrence Mitchell <wence@gmx.li>
121
122 * erc.el(erc-latest-version): Clean up docstring.
123 Remove requirement for w3, wrap REQUIRE statement in IGNORE-ERRORS.
124 Update viewcvs url to correct location.
125 (erc-ediff-latest-version): Make sure that we find the uncompiled
126 erc.el, error if not.
127
1282003-11-07 Mario Lang <mlang@delysid.org>
129
130 * erc.el: Add more info to /sv
131
1322003-11-06 Francis Litterio <franl@users.sourceforge.net>
133
134 * erc.el: Added optional argument BUFFER to erc-server-buffer-p.
135
1362003-11-04 Mario Lang <mlang@delysid.org>
137
138 * AUTHORS: Add sachac
139
1402003-11-02 Lawrence Mitchell <wence@gmx.li>
141
142 * erc.el(erc-server-366):
143 chnl is 4th element of parsed, not fifth.
144 (erc-channel-end-receiving-names): Pass correct number of arguments
145 to delete-if-not.
146
147 * erc.el(erc-update-current-channel-member):
148 Use erc-downcase when comparing
149 nick entries. Cleanup indentation.
150
1512003-11-01 Lawrence Mitchell <wence@gmx.li>
152
153 * erc-sound.el: Added a (provide 'erc-sound) line.
154
155 * erc.el(erc-cmd-NAMES): send to TGT, not CHANNEL.
156
1572003-10-29 Sandra Jean Chua <sacha@free.net.ph>
158
159 * erc-pcomplete.el, erc.el, CREDITS:
160 Merged Jeremy Maitin-Shepard's patch for time-sensitive nick completion.
161
1622003-10-27 Mario Lang <mlang@delysid.org>
163
164 * Makefile, debian/changelog:
165 New Debian package 4.0.cvs.20031027
166
1672003-10-25 Mario Lang <mlang@delysid.org>
168
169 * erc.el: Fix typo tuncate->rruncate
170
1712003-10-24 Mario Lang <mlang@delysid.org>
172
173 * erc-dcc.el: From Stephan Stahl <stl@isogmbh.de>:
174 * (erc-dcc-send-block): Kill buffer if transfer completed correctly.
175
1762003-10-22 Mario Lang <mlang@delysid.org>
177
178 * erc-track.el(erc-track-disable):
179 Do not deactivate all advices for `switch-to-buffer',
180 just disable the erc specific one. (Bug#217022).
181
1822003-10-18 Lawrence Mitchell <wence@gmx.li>
183
184 * erc-log.el(erc-log-file-coding-system): New variable.
185 (erc-save-buffer-in-logs): Use it.
186
1872003-10-17 Mario Lang <mlang@delysid.org>
188
189 * erc.el(erc-interpret-mirc-color): New boolean defcustom
190
191 * erc.el: Do not use -nowait on darwin (thanks johnw)
192
1932003-10-15 Lawrence Mitchell <wence@gmx.li>
194
195 * erc.el(define-erc-module):
196 Set erc-FOO-mode appropriately in erc-FOO-enable
197 and erc-FOO-disable.
198
1992003-10-12 Jorgen Schaefer <forcer@users.sourceforge.net>
200
201 * erc-autoaway.el(erc-mode):
202 Reset idletime on connect. Fixes an annoying bug which
203 flooded the server with aways on reconnect.
204 (erc-autoway-reset-idletime): Accept optional args so we can hook it
205 onto erc-server-001-hook.
206
2072003-10-10 Mario Lang <mlang@delysid.org>
208
209 * erc.el(erc-hide-list): Add a nice defcustom type
210
2112003-10-08 Mario Lang <mlang@delysid.org>
212
213 * Makefile, debian/changelog, debian/control:
214 Debian snapshot 20031008
215
216 * erc-speedbar.el:
217 Patch from Eric M. Ludlam <eric@siege-engine.com>:
218 - (erc-install-speedbar-variables): Add functions list (needs new speedbar?)
219 - (erc-speedbar-buttons): Add doc. Clear the buffer
220 - (erc-speedbar-sort-channel-members): New function.
221 - (erc-speedbar-expand-channel): Call new sort function. Change some visuals.
222 - (erc-speedbar-insert-user): Change some visuals based on channel data.
223 - (erc-speedbar-line-text, erc-speedbar-item-info): New functions
224 Add proper elisp file header.
225
2262003-10-02 Lawrence Mitchell <wence@gmx.li>
227
228 * erc-match.el(erc-match-syntax-table): New variable.
229 (erc-match-current-nick-p): Use it.
230
231 * erc.el(erc-quit-reason-zippy, erc-part-reason-zippy): Use
232 `erc-replace-regexp-in-string' rather than
233 `replace-regexp-in-string'.
234 (erc-command-indicator-face): New face, used to show commands if
235 `erc-hide-prompt' is nil and `erc-command-indicator' is non-nil.
236 (erc-command-indicator): Clean up doc-string.
237 (erc-display-prompt): New optional argument FACE, use this rather
238 than `erc-prompt-face' to fontify the prompt if non-nil.
239 (erc-send-current-line): Pass in `erc-command-indicator-face' to
240 `erc-display-prompt'.
241
242 * erc-compat.el(erc-replace-regexp-in-string): New function.
243 Alias for `replace-regexp-in-string' on Emacs 21.
244 Argument massaging for `replace-in-string' for XEmacs.
245
2462003-09-28 Jorgen Schaefer <forcer@users.sourceforge.net>
247
248 * erc.el(erc-keywords): Removed. Wasn't used by anything.
249
2502003-09-25 Lawrence Mitchell <wence@gmx.li>
251
252 * erc.el: ERC-HIDE-PROMPT: add custom group
253 ERC-COMMAND-INDICATOR: new variable.
254 ERC-COMMAND-INDICATOR: new function.
255 ERC-DISPLAY-PROMPT: new argument, PROMPT, used to override default
256 prompt.
257 ERC-SEND-CURRENT-LINE: pass ERC-COMMAND-INDICATOR to ERC-DISPLAY-PROMPT.
258
2592003-09-24 Jorgen Schaefer <forcer@users.sourceforge.net>
260
261 * erc.el(erc-parse-line-from-server):
262 Ignore empty lines as required by RFC.
263
2642003-09-17 Mario Lang <mlang@delysid.org>
265
266 * erc.el: Add lag time calculation
267
2682003-09-13 Mario Lang <mlang@delysid.org>
269
270 * Makefile, debian/README.Debian, debian/changelog:
271 New debian release
272
273 * erc-notify.el:
274 Call erc-notify-install-message-catalogs on load, not on module init
275
276 * erc.el(erc-update-modules):
277 Use `load' instead of `require'. XEmacs appears
278 to have the NOERROR arg only sometimes... Strange
279
280 * erc.el: No fboundp if we have a defvar
281
282 * erc.el: Properly defvar erc-ping-handler
283
2842003-09-11 Damien Elmes <erc@repose.cx>
285
286 * erc.el(erc-setup-periodical-server-ping):
287 check if erc-ping-handler is
288 bound before referencing it
289
2902003-09-10 Mario Lang <mlang@delysid.org>
291
292 * erc.el(erc-cmd-NICK):
293 Warn about exceeded NICKLEN if we know it.
294
295 * erc.el: Make erc-server-PONG obey erc-verbose-server-ping.
296 Cancel old `erc-ping-handler' timer when restablishing connection in the same
297 buffer.
298
299 * debian/changelog, Makefile: New debian snapshot
300
301 * erc-dcc.el, erc-xdcc.el:
302 Use new function erc-dcc-file-to-name to convert spaces to underscores
303
304 * erc-xdcc.el: Add autoload for erc-xdcc-add-file
305
3062003-09-08 Mario Lang <mlang@delysid.org>
307
308 * erc-dcc.el: indent fixes and copyright update
309
310 * erc.el:
311 erc-send-ping-interval: New defcustom which defaults to 60.
312 Every 60 seconds, we send PING now.
313 This should fix the "connection silently lost" bug.
314 Please test this change extensively, and report problems.
315
3162003-09-07 Alex Schroeder <alex@gnu.org>
317
318 * erc.el(erc-default-coding-system):
319 Test for undecided and utf-8
320 before setting.
321
3222003-09-01 Mario Lang <mlang@delysid.org>
323
324 * erc.el(erc-modules): Add some more symbols to the set
325
326 * erc.el(erc-modules): * erc.el(erc-modules): Add :greedy t to the set in
327
328 * erc-dcc.el:
329 More autoloads which make dcc autoload upon ctcp dcc query received.
330
331 * erc-dcc.el(erc-cmd-DCC): Add Autoload.
332 (pcomplete/erc-mode/DCC): Ditto, makes DCC autoloadable just by using
333 completion.
334 Also only offer "send" if fboundp make-network-process.
335
336 * erc-autojoin.el: Update copyright
337
338 * erc-autojoin.el(erc-autojoin-add):
339 Only add the channel if it is not already there.
340
341 * erc-notify.el:
342 Use `define-erc-module' instead of old `erc-notify-initialize'.
343 Now defines the global minor mode erc-notify-mode, and should also
344 be controllable via `erc-modules' with symbol `notify'.
345
346 * erc.el(erc-modules):
347 Fix paren-in-column-zero bug in docstring.
348 Add a sort of bogus, but still better :type.
349 Add autojoin and netsplit by default.
350 (erc-update-modules): Dont barf with an error if `require' fails.
351 We can still error out if the mode is not defined.
352
3532003-08-31 Andreas Fuchs <asf@void.at>
354
355 * erc.el:
356 * make 353 (NAMES reply) output go into the appropriate channel buffer
357 (if it exists) or into the active erc buffer (if not).
358
3592003-08-29 mtoledo <mtoledo@confusibombus>
360
361 * erc.el:
362 Added the variable erc-echo-notices-in-current-buffer to make possible display notices in the current buffer (queries to nickserv/chanserv/memoserv). Defaults to nil so nothing changes from what we have today.
363
3642003-08-29 Mario Lang <mlang@delysid.org>
365
366 * erc.el: Fix typo in varname which led to a compiler warning
367
368 * AUTHORS: Added lawrence
369
3702003-08-27 Mario Lang <mlang@delysid.org>
371
372 * erc-dcc.el:
373 Set process and file-coding system to 'binary (for Windows)
374
375 * erc-stamp.el: Rename custom group erc-timestamp to erc-stamp.
376
3772003-08-07 Lawrence Mitchell <wence@gmx.li>
378
379 * erc-fill.el(erc-fill-disable):
380 Remove erc-fill, not erc-fill-static from
381 erc-insert-modify-hook.
382
3832003-08-05 Francis Litterio <franl@users.sourceforge.net>
384
385 * erc.el(erc-send-current-line):
386 Now we display the prompt for previously entered commands
387 based on the value of customization variable erc-hide-prompt. This change is
388 closely related to the immediate previous version by wencem.
389
3902003-08-04 Lawrence Mitchell <wence@gmx.li>
391
392 * erc.el(erc-send-current-line):
393 If we're sending a command, don't display
394 the prompt.
395
3962003-08-04 Damien Elmes <erc@repose.cx>
397
398 * erc-track.el: patch from David Edmondson (dme AT dme DOT org)
399
400 This patch makes button 3 on the erc-track buffer names in the
401 modeline show the selected buffer in another window. It's analogous to
402 button 2 which shows the buffer in the current window.
403
4042003-07-31 Francis Litterio <franl@users.sourceforge.net>
405
406 * erc.el(erc-display-line-1):
407 Fixed bad indentation on one line. No semantic change.
408
4092003-07-29 Lawrence Mitchell <wence@gmx.li>
410
411 * erc-match.el:
412 Quote open paren in docstring of erc-text-matched-hook
413
414 * erc.el: Anchor match only at beginning in erc-ignored-user-p.
415
416 * erc-button.el: New variable erc-button-wrap-long-urls.
417 Modified erc-button-add-buttons:
418 New optional argument REGEXP.
419 If we're buttonising a URL and erc-button-wrap-long-urls is
420 non-nil, try and wrap them
421
422 Modified erc-button-add-buttons-1:
423 Pass regexp to erc-button-add-buttons.
424
4252003-07-28 Francis Litterio <franl@users.sourceforge.net>
426
427 * erc.el(erc-network-name):
428 Improved docstring. Removed an unnecessary call to erc-server-buffer.
429
4302003-07-28 Mario Lang <mlang@delysid.org>
431
432 * erc.el: By lawrence:
433 (erc-ignored-user-p): Use anchored regexp.
434 (smiley): Fix missing quote in `remove-hook' call.
435
4362003-07-26 Francis Litterio <franl@users.sourceforge.net>
437
438 * erc-nets.el, erc-nickserv.el, erc.el:
439 Changed all references to Openprojects into references to Freenode.
440
4412003-07-25 Francis Litterio <franl@users.sourceforge.net>
442
443 * erc.el:
444 Now variable erc-debug-irc-protocol is defvar'ed instead of defcustom'ed.
445 Made the docstring clearer too.
446
447 * erc.el: Fixed a wrong-type-argument error from window-live-p.
448
4492003-07-15 Damien Elmes <erc@repose.cx>
450
451 * erc-log.el(erc-log-setup-logging):
452 set buffer-file-name to "", as (basic-save-buffer)
453 will prompt for a buffer name before invoking hooks. the buffer-file-name
454 will be overridden by (erc-save-buffer-in-logs) anyway - the main danger
455 of doing this is write-file-contents hooks. Let's see if anyone complains.
456 (erc-save-buffer-in-logs): return t, so that further write hooks are not run
457
4582003-07-09 Damien Elmes <erc@repose.cx>
459
460 * erc-dcc.el(erc-dcc-open-network-stream):
461 -nowait still crashes emacs cvs - disable for now
462
4632003-07-02 Francis Litterio <franl@users.sourceforge.net>
464
465 * erc.el(erc): Minor docstring modification.
466
4672003-07-01 Damien Elmes <erc@repose.cx>
468
469 * erc-match.el(erc-match-current-nick-p):
470 match only on word boundaries
471
472 * erc-log.el(erc-log-setup-logging):
473 not sure how this crept in again - make sure we set
474 buffer-file-name to nil, since otherwise it is not possible to open
475 previous correspondence in another buffer while a conversation is open
476
4772003-06-28 Francis Litterio <franl@users.sourceforge.net>
478
479 * erc.el(erc-network-name):
480 Now makes some intelligent guesses if the server didn't tell
481 us the network name.
482
4832003-06-28 Alex Schroeder <alex@gnu.org>
484
485 * erc.el(erc-default-coding-system): Use utf-8 as the default
486 encoding for outgoing stuff and undecided as the default for
487 incoming stuff.
488 (erc-coding-sytem-for-target): New.
489 (erc-encode-string-for-target): Use it.
490 (erc-decode-string-from-target): Use it. Removed the flet
491 erc-default-target hack and documented the dynamically bound
492 variable `target' instead.
493
4942003-06-25 Francis Litterio <franl@users.sourceforge.net>
495
496 * erc.el(erc-log-irc-protocol):
497 Now we keep point on the bottom line of the window
498 displaying the *erc-protocol* buffer if it is at the end of the
499 *erc-protocol* buffer.
500
501 * erc.el:
502 Added some text to the docstring for variable erc-debug-irc-protocol.
503
5042003-06-23 Francis Litterio <franl@users.sourceforge.net>
505
506 * erc-dcc.el(erc-dcc-auto-mask-p):
507 Fixed a docstring typo that caused a load-time error.
508
509 * erc-dcc.el(erc-dcc-auto-mask-p):
510 Changed reference to undefined variable erc-dcc-auto-mask-list
511 to erc-dcc-auto-masks.
512 Changed default value of variable erc-dcc-auto-masks to nil and added text to its
513 docstring.
514
515 * erc-notify.el(erc-notify-timer and erc-notify-QUIT):
516 Added network name to notify_off message.
517
518 * erc.el(erc-network-name):
519 Now returns the name of the IRC server if the network name
520 cannot be determined.
521
522 * erc-notify.el(erc-notify-JOIN and erc-notify-NICK):
523 Added argument ?m to call to erc-display-message.
524
525 * erc-dcc.el(erc-dcc-do-LIST-command):
526 Fixed a bug where I assumed (plist-get elt :type)
527 returns a string -- it really returns a symbol.
528
529 * erc-notify.el(erc-notify-timer):
530 Now we include the network name in the notify_on message.
531
532 * erc.el:
533 New function: erc-network-name. Returns the name of the network that the
534 current buffer is associate with. Not every server sends the 005 messages
535 that enable the network name to be known. If the network name is
536 not known, the string "UNKNOWN" is returned.
537
538 * erc-dcc.el(erc-dcc-chat-setup):
539 Added a comment. Fixed a bug where a DCC CHAT buffer has no
540 prompt when it first appears.
541
542 * erc-dcc.el(erc-dcc-chat-parse-output):
543 Now a DCC chat buffer displays the nick using
544 erc-nick-default-face just like in a channel buffer.
545
5462003-06-22 Francis Litterio <franl@users.sourceforge.net>
547
548 * erc.el(erc-display-prompt):
549 Fixed incorrect indentation. No semantic change.
550
551 * erc.el(erc-strip-controls):
552 Minor change to regexp that matches IRC color control
553 codes. I was seeing usage as follows: ^C07colored text^C^C04other color.
554 Now we strip a ^C followed by zero, one, or two digits. Before this change,
555 we stripped a ^C followed by one or two digits.
556
557 * erc-dcc.el(erc-dcc-do-LIST-command):
558 Improved format of output of /DCC LIST. Now the
559 "Size" column for a DCC GET includes the percentage of the file that has
560 been retrieved.
561 (erc-dcc-do-GET-command): Now it works if erc-dcc-default-directory is set.
562
5632003-06-19 Damien Elmes <erc@repose.cx>
564
565 * erc-log.el:
566 * added quickstart information to the comments up the top
567
5682003-06-16 Mario Lang <mlang@delysid.org>
569
570 * erc.el:
571 Default to open-network-stream on MS Windows. (thanks lawrence)
572
5732003-06-11 Damien Elmes <erc@repose.cx>
574
575 * erc.el(erc-process-input-line):
576 refactor so that wrong-number-of-arguments is
577 caught when using do-not-parse-args - this lets do-not-parse-args
578 commands display help messages on incorrect syntax in a uniform manner.
579 This no longer raises a bad-syntax error - was this a catch-all to stop a
580 backtrace? Does it belong?
581 (erc-cmd-APPENDTOPIC): the correct way to display help when you want to
582 accept an abitrary string is to (signal 'wrong-number-of-arguments nil).
583 This fixes a bug where people could not /at topics with a space in them.
584
5852003-06-09 Damien Elmes <erc@repose.cx>
586
587 * erc.el:
588 Re-add the last few changes which weren't merged for some reason.
589
590 * erc.el(erc-cmd-APPENDTOPIC): show help when given no arguments
591
592 Patch from MrBump. Fixes problem with erc-set-topic inserting ^C characters
593 into the topic. Also removes dependency on CL.
594
5952003-06-08 Jorgen Schaefer <forcer@users.sourceforge.net>
596
597 * erc.el:
598 Added comment to explain (eval-after-load "erc" '(erc-update-modules)).
599
6002003-06-01 Mario Lang <mlang@delysid.org>
601
602 * erc-pcomplete.el: Add completion for /unignore
603
6042003-05-31 Alex Schroeder <alex@gnu.org>
605
606 * erc-compat.el(erc-encode-coding-string): The default binding,
607 if encode-coding-string was not available, must be a defun that
608 takes multiple arguments. Did that.
609
6102003-05-30 Mario Lang <mlang@delysid.org>
611
612 * erc.el:
613 Add handlers for 313 and 330 (by arne@rfc2549.org, thanks)
614
6152003-05-30 Damien Elmes <erc@repose.cx>
616
617 * erc.el:
618 patch from MrBump to make /mode #foo +b work again (erc-cmd-BANLIST only
619 temporarily changes them now)
620
6212003-05-29 Alex Schroeder <alex@gnu.org>
622
623 * erc.el(erc-select):
624 server is now defaulted with erc-compute-server.
625 A few cosmetic fixes.
626 (erc-default-coding-system): Renamed from erc-encoding-default.
627 (erc-encoding-default): Renamed to erc-default-coding-system.
628 (erc-encoding-coding-alist): Documentation updated to cover regexps.
629 (erc-encode-string-for-target): Now considers keys of
630 erc-encoding-coding-alist to be regexps. Rely on erc-compat
631 wrt. MULE support.
632 (erc-decode-string-from-target): New function.
633 (erc-send-current-line): eq -> char-equal fix.
634 (erc-server-TOPIC): topic is now decoded with
635 erc-decode-string-from-target.
636 (erc-parse-line-from-server): Line from server is no longer decoded
637 here.
638 (erc-server-PRIVMSG-or-NOTICE): Message from a user is decoded here,
639 sspec -> sender-spec for clarity. Cosmetic if -> when fix.
640 (erc-server-TOPIC): sspec -> sender-spec
641 (erc-server-WALLOPS): Ditto.
642
643 * erc-compat.el(erc-decode-coding-string):
644 Now requires coding-system as an argument.
645
6462003-05-15 Mario Lang <mlang@delysid.org>
647
648 * erc.el:
649 erc-part|quit-hook is only run on a part|quit directed to our nick, reflect that in the docstring to avoid confusion
650
6512003-05-01 Andreas Fuchs <asf@void.at>
652
653 * erc-truncate.el:
654 * erc-truncate-buffer-to-size: use fboundp. Scheme takes its toll...
655
6562003-05-01 Jorgen Schaefer <forcer@users.sourceforge.net>
657
658 * erc-truncate.el: remove require of erc-log
659 (erc-truncate-buffer-to-size): use erc-save-buffer-in-logs when it's
660 there, else, dont.
661
6622003-04-29 Andreas Fuchs <asf@void.at>
663
664 * erc-log.el, erc-truncate.el, erc.el: erc.el:
665 * erc-cmd-QUIT: Remove references to code in erc-log.el, to
666 not force autoloading of erc-log.el
667 * erc-server-PART: ditto.
668 * erc-quit-hook: new hook, run when /quit command is
669 processed.
670 * erc-cmd-QUIT: use it.
671 * erc-part-hook: new hook, run then PART message is
672 processed.
673 * erc-cmd-PART: use it.
674 * erc-connect-pre-hook: new hook, run before connection to IRC
675 server is started.
676 * erc: use it.
677 * erc-max-buffer-size: Move truncation variables and functions
678 to erc-truncate.el
679 * erc-truncate-buffer-on-save: moved to erc-log.el
680 * erc-initialize-log-marker: new function.
681 erc-log.el:
682 * erc-truncate-buffer-on-save: New defcust here; from erc.el
683 * erc-truncate-buffer-on-save: Put it in group `erc-log'
684 * erc-log-channels-directory: Remove trailing slash from
685 default value.
686 * Add functions to erc-connect-pre-hook, erc-part-hook and
687 erc-quit-hook to avoid getting autoloaded.
688
689 erc-truncate.el:
690 * Contains the truncation functions and defcusts from erc.el.
691 * define-erc-module clause added; new erc-truncate-mode.
692
6932003-04-29 Jorgen Schaefer <forcer@users.sourceforge.net>
694
695 * erc.el(erc):
696 Check wether erc-save-buffer-in-logs is bound, too
697
698 * erc.el(erc):
699 Check wether erc-logging-enabled is bound before using it - not
700 everyone is using erc-log.el!
701
7022003-04-28 Andreas Fuchs <asf@void.at>
703
704 * erc-log.el:
705 * while we're at it, remove the (declare (ignore ignore)) statements.
706
707 * erc-log.el:
708 * add autoload statement for erc-log-mode/etc. Sorry for the delay.
709
710 * erc-log.el, erc.el: * erc.el:
711 - move variables and functions to erc-log.el:
712 defgroup `erc-log'
713 defcustom `erc-log-channels-directory'
714 defcustom `erc-log-insert-log-on-open'
715 defcustom `erc-generate-log-file-name-function'
716 defun `erc-save-buffer-in-logs' (autoloads from erc-log.el)
717 defuns `erc-generate-log-file-name-*'
718 defun `erc-current-logfile'
719 defun `erc-logging-enabled' (autoloads from erc-log.el)
720 - erc-truncate-buffer-to-size: fix for double-saving bug when
721 writing out truncated buffer contents. Thanks, lawrence mitchell <wence@gmx.li>!
722 - erc-remove-text-properties-region: Fix case for read-only text.
723 - erc-send-current-line: update insert-marker before calling the hooks.
724 also, wrap (erc-display-prompt) so that it doesn't toggle
725 buffer-modified-p.
726 - erc-interpret-controls: remove /very/ old commented-out function
727 - erc-last-saved-position: make it a marker
728 - erc: use it.
729
730 * erc-log.el: (thanks, lawrence mitchell <wence@gmx.li>!)
731 - Move logging code from erc.el here
732 - define-erc-module log: add; minor mode erc-log-mode is the
733 same as adding the `erc-save-buffer-in-logs' to
734 erc-send-post-hook and `erc-insert-post-hook'.
735 - erc-w32-invalid-file-characters: add.
736 - erc-enable-logging: add.
737 - erc-logging-enabled: use it.
738 - erc-logging-enabled: autoload.
739 - erc-save-buffer-in-logs: fix for truncating saved buffer with read-only text.
740 - erc-save-buffer-in-logs: use erc-last-saved-position.
741 - erc-save-buffer-in-logs: fix saving half-written messages on
742 the prompt when saving the log file. (simply uses
743 erc-insert-marker as an upper bound for saving).
744
7452003-04-27 Damien Elmes <erc@repose.cx>
746
747 * erc.el: * erc.el: erc-modules: added
748
7492003-04-27 Alex Schroeder <alex@gnu.org>
750
751 * Makefile(UNCOMPILED): Added erc-compat.el.
752 (clean): Remove .elc files, too.
753 Patch by Hynek Schlawack <hynek+erc@hys.in-berlin.de>
754
7552003-04-22 Damien Elmes <erc@repose.cx>
756
757 * erc-button.el:
758 erc-button-keymap: set the parent keymap to erc-mode-map
759
7602003-04-20 Damien Elmes <erc@repose.cx>
761
762 * erc.el:
763 erc-official-location: shouldn't the official location be the base URL of erc?
764
765 * erc.el:
766 erc-modules: updated the docstring to make the semantics clearer
767
7682003-04-19 Mario Lang <mlang@delysid.org>
769
770 * erc.el:
771 Fix problem where % in NOTICE produced errors (from mmc)
772
7732003-04-18 Damien Elmes <erc@repose.cx>
774
775 * erc.el(erc-toggle-debug-irc-protocol):
776 moved a reference to 'buf' inside the let
777 statement which defines it. it's difficult to tell what the original
778 intentions were here - at the moment the debug window is displayed when
779 toggling either way.
780
781 * README, erc.el:
782 (erc-update-modules: added a condition in for erc-nickserv -> erc-services
783
784 * erc-pcomplete.el:
785 - that change to erc-update-modules making it require the modules first means
786 we don't need any special case handling here, so i reverted the previous
787 change
788
789 * erc.el:
790 - don't require 'erc-auto, since windows users don't have access to make.
791 instead, we handle it in (erc-update-modules)
792
7932003-04-17 Damien Elmes <erc@repose.cx>
794
795 * README, Makefile:
796 Updated Makefile and documentation to reflect the new release
797
798 * erc.el:
799 - note the previous change also updated the release number to erc 4.0!
800 (erc-connect): fix a bug introduced by the previous release
801
802 * erc.el:
803 fixed about 20 instances of (message (format ...)) which will break if the
804 format returns a string with %s in it
805
806 * erc.el: erc-error-face: make it red, not pink
807
808 * erc-pcomplete.el:
809 since pcomplete is autoloaded via erc-completion-mode, and completion is in
810 erc-modules by default, we remove completion when pcomplete is added
811
812 * erc.el(define-erc-module): no need for delete, use delq
813
814 * erc-members.el(erc-nick-channels):
815 (erc-person-channels) takes one arg
816 (erc-format-user): again, they all take an arg
817
818 * erc.el:
819 - require erc-auto when loading, so the default `erc-modules' can be loaded.
820 this makes erc-auto no longer a convenience but a necessity - all the name
821 of user friendliness.
822 (define-erc-module): the enable and disable routines now update erc-modules
823 accordingly
824 erc-modules: new variable controllig the modules which erc has loaded/will
825 load. when customising, it will automatically enable modules. it won't
826 automatically disable modules which are removed, yet.
827 (erc-update-modules): enable all modules in `erc-modules'
828
829 * erc-dcc.el(erc-dcc-open-network-stream):
830 use the -nowait equiv if available
831 erc-dcc-server-port: removed
832 erc-dcc-port-range: allows a range of values, so you can have more than one
833 dcc
834 (erc-dcc-server): support erc-dcc-port-range
835 (erc-dcc-chat): use OCHAT for outgoing chat for now. we need to fix the
836 issues with allowing more than one chat with the same person
837
838 * erc.el:
839 erc-log-channels: removed; set the directory to start logging
840 (erc-directory-writeable-p): create directory if it doesn't exist, check if
841 it's writeable
842 (erc-logging-enabled): don't reference erc-log-channels
843
8442003-04-07 Damien Elmes <erc@repose.cx>
845
846 * erc.el(erc):
847 but when inserting the contents of a previous logfile, use the logfile
848 name, not ""!
849
850 * erc.el(erc):
851 set buffer-file-name to "", since we have a custom saving function and
852 it's not needed. this enables one to open a log file with previous
853 correspondence, while talking to the person at the same time
854
8552003-03-29 Francis Litterio <franl@users.sourceforge.net>
856
857 * erc.el(erc-prepare-mode-line-format):
858 Now strips all text properties from the target before
859 putting it in the mode line. Keeps the mode line looking consistent.
860 (erc-channel-p): Improved docstring.
861
8622003-03-28 Alex Schroeder <alex@gnu.org>
863
864 * erc.el(erc-generate-log-file-name-with-date): New function.
865 (erc-generate-log-file-name-function): Make it available.
866
8672003-03-24 Mario Lang <mlang@delysid.org>
868
869 * erc.el:
870 Fix erc-prompt and erc-user-mode custom :type (Closes: #185794)
871
8722003-03-20 Damien Elmes <erc@repose.cx>
873
874 * erc.el:
875 erc-server-hook-list: correct documentation of ordering of (proc parsed)
876
8772003-03-16 Alex Schroeder <alex@gnu.org>
878
879 * erc-track.el(erc-modified-channels-string):
880 Make it a risky-local-variable.
881
8822003-03-16 Jorgen Schaefer <forcer@users.sourceforge.net>
883
884 * erc-track.el(erc-track-modified-channels):
885 Use (point-min) if we don't find a
886 parsed-property, so it won't error out with nil...
887
8882003-03-16 Damien Elmes <erc@repose.cx>
889
890 * erc-track.el(erc-track-switch-buffer):
891 removed call to erc-modified-channels-update, as
892 this is done correctly on buffer switching in both emacs and xemacs now
893
8942003-03-15 Damien Elmes <erc@repose.cx>
895
896 * erc-track.el(erc-find-parsed-property):
897 simplified a little, so it shouldn't return nil anymore
898
899 * erc.el: erc-send-post-hook: document narrowing which occurs
900
9012003-03-14 Alex Schroeder <alex@gnu.org>
902
903 * erc-track.el(erc-find-parsed-property): New function.
904 (erc-track-modified-channels): Use it instead of relying on
905 point-min.
906
9072003-03-12 Mario Lang <mlang@delysid.org>
908
909 * erc.el:
910 Fix erc-set-topic to accept a channel name as first word
911
9122003-03-11 Jorgen Schaefer <forcer@users.sourceforge.net>
913
914 * erc-dcc.el:
915 Small patch (<10 lines, also slightly modified by Jorgen Schäfer) from
916 David Spreen <netzwurm@debian.org> to add hostmask-authentication to
917 DCC auto-accept.
918
919 erc-dcc-auto-mask-list: New variable
920 (erc-dcc-handle-ctcp-send): Check erc-dcc-auto-mask-list
921 (erc-dcc-auto-mask-p): New function
922 erc-dcc-send-request: Docstring now mentions erc-dcc-auto-mask-list
923
9242003-03-10 Francis Litterio <franl@users.sourceforge.net>
925
926 * erc-ring.el(erc-clear-input-ring):
927 New function. Erases the contents of the input ring for
928 the current ERC buffer.
929
9302003-03-08 Francis Litterio <franl@users.sourceforge.net>
931
932 * erc.el:
933 (erc-display-line-1) and (erc-send-current-line): Now these functions reset erc-insert-this
934 to t as soon as possible after consuming the value of that variable. See the comments in
935 the code for the strange symptom this fixes.
936 (erc-bol): Changed to call point-at-eol instead of line-end-position. This increases XEmacs
937 portability, since XEmacs doesn't have line-end-position. Patch suggested by Scott Evans
938 on the ERC mailing list.
939
9402003-03-04 Damien Elmes <erc@repose.cx>
941
942 * erc.el: banlist*: patch from mrbump to avoid using cl packages
943
9442003-03-04 Francis Litterio <franl@users.sourceforge.net>
945
946 * erc.el:
947 Changed erc-noncommands-list from a constant to variable, so that users can
948 add their own erc-cmd-* functions to the list. Improved the docstring too.
949
9502003-03-02 Francis Litterio <franl@users.sourceforge.net>
951
952 * erc.el(erc-server-353):
953 Now the output of "/NAMES #channel" appears in the currently
954 active ERC buffer, even if the user is not a member of #channel.
955
956 * erc.el(erc-cmd-DEOP):
957 Fixed a syntax error: invalid read syntax ")" caused by my last change.
958
9592003-03-01 Francis Litterio <franl@users.sourceforge.net>
960
961 * erc.el(erc-cmd-DEOP):
962 Fixed a wrong-type-argument error caused by calling split-string
963 on a list instead of on a string. Removed the call to split-string entirely,
964 because it wasn't needed.
965
966 * erc.el(erc-cmd-HELP):
967 Changed to use intern-soft instead of intern. Now "/HELP floob"
968 doesn't create a void function symbol erc-cmd-FLOOB.
969
9702003-02-25 Damien Elmes <erc@repose.cx>
971
972 * erc.el(erc-cmd-SERVER):
973 remove erroneous references to line, use server instead
974
9752003-02-23 Francis Litterio <franl@users.sourceforge.net>
976
977 * erc.el(erc-toggle-debug-irc-protocol):
978 Fixed a bug where the global value of
979 kill-buffer-hook was being modified instead of the buffer-local value.
980
9812003-02-22 Francis Litterio <franl@users.sourceforge.net>
982
983 * erc.el(erc-cmd-KICK):
984 Now supports any number of words in the REASON string. Examples
985 of the /KICK command are:
986 /KICK franl You don't belong here
987 /KICK franl Bye
988 /KICK franl
989 /KICK #channel franl Go away now
990 /KICK #channel franl Bye
991 /KICK #channel franl
992
9932003-02-16 Jorgen Schaefer <forcer@users.sourceforge.net>
994
995 * erc-stamp.el(erc-insert-timestamp-right):
996 Make the timestamp rear-nonsticky, so
997 C-e works at the beginning of the next line.
998
9992003-02-16 Andreas Fuchs <asf@void.at>
1000
1001 * erc-stamp.el:
1002 * s/choose/choice/ in customize options, as kensanata requested.
1003
10042003-02-15 Francis Litterio <franl@users.sourceforge.net>
1005
1006 * erc.el(erc-toggle-debug-irc-protocol):
1007 Now if the *erc-protocol* buffer is killed,
1008 logging is turned off. Prior to this change, the buffer would come back
1009 into existence (generally unbeknownst to the user) after being killed.
1010
10112003-02-11 Damien Elmes <erc@repose.cx>
1012
1013 * erc.el(erc-send-current-line):
1014 we can't inhibit everything here when not connected,
1015 as the user will expect commands like /server still to work. the
1016 erc-cmd-handler should recover from errors instead
1017
10182003-02-10 Damien Elmes <erc@repose.cx>
1019
1020 * erc.el:
1021 * we now run erc-after-connect on 422 (no motd) messages as well as the motd
1022 messages
1023 (erc-login): revert the previous change
1024
1025 * erc.el(erc-login): register that we're connected
1026
10272003-02-10 Mario Lang <mlang@delysid.org>
1028
1029 * erc-members.el: * Provide erc-members
1030 * Fix excessive )
1031 * Comment out broken self-tests
1032
10332003-02-07 Damien Elmes <erc@repose.cx>
1034
1035 * erc.el(erc-connect):
1036 notify the user we're trying to connect when using asych
1037 connections
1038
1039 * erc.el(erc-connect): support an asyncronous connection
1040 (erc-process-sentinel): ditto
1041
1042 * erc-track.el:
1043 * advise switch-to-buffer in the case of xemacs, since it doesn't have
1044 window-configuration-change-hook
1045
1046 * erc.el(erc-send-current-line):
1047 if not connected, refuse to send either a message or
1048 a command
1049
1050 * erc.el: (erc-save-buffer-in-logs):
1051 - check for a sensibile region before saving the buffer. if the
1052 connection process is killed early on, there is not a sensible region
1053 to save
1054 - don't set buffer-file-name on save. we don't need it, and it means we
1055 can now find-file a log while an existing query is open with that
1056 user
1057
1058 * erc.el(erc-process-input-line):
1059 when displaying the help for a function, if no
1060 documentation exists, don't fall over
1061 (erc-cmd-SAY): new function for quoting lines begining with /
1062 (erc-server-NICK):
1063 - fix a bug where the "is now known as" message doesn't appear on newly
1064 created /query buffers
1065 - when a user changes their nick, update the query to point to the new
1066 nick
1067
1068 * erc.el(erc-send-current-command):
1069 don't reject multi-line commands. since
1070 multiline-p is used as the no-command arg to erc-process-current-line,
1071 multi-line text is never interpreted as a command. i believe this is the
1072 correct behavior - it allows people to post the output of things like df
1073 (sans header). if you want to change this, please provide a rationale
1074 in the changelog
1075
1076 * erc.el(erc-send-current-line):
1077 only match the first line when determining if a
1078 multi-line command is allowed
1079
10802003-02-07 Jorgen Schaefer <forcer@users.sourceforge.net>
1081
1082 * erc-bbdb.el(erc-bbdb-highlight-record):
1083 Use alternate strings, not character
1084 classes to split the nick-field.
1085
10862003-02-06 Francis Litterio <franl@users.sourceforge.net>
1087
1088 * erc.el(erc-process-sentinel):
1089 Now we set erc-connected to nil every time we disconnect
1090 from a server, not just when an unexpected disconnect happens.
1091
1092 * erc.el(erc-connected):
1093 Removed redundant defvar of this variable. Improved the
1094 docstring.
1095 (erc-login): Changed to send a correct RFC2812 USER message (see section
1096 3.1.3 of RFC2812 for the documentation of the semantics of each argument
1097 of the USER message.
1098
10992003-02-02 Damien Elmes <erc@repose.cx>
1100
1101 * erc.el(erc-cmd-NOTICE): fix from mrbump
1102
11032003-01-31 Francis Litterio <franl@users.sourceforge.net>
1104
1105 * erc.el(erc-cmd-JOIN):
1106 Now we only send one JOIN command to the server when a channel
1107 key is provided.
1108
11092003-01-30 Francis Litterio <franl@users.sourceforge.net>
1110
1111 * erc.el(erc-remove-channel-member):
1112 Fixed so that it runs erc-channel-members-changed-hook
1113 with the channel buffer current, as is documented in the docstring for variable
1114 erc-channel-members-changed-hook: "The buffer where the change happened is
1115 current while this hook is called."
1116
11172003-01-28 Francis Litterio <franl@users.sourceforge.net>
1118
1119 * erc.el:
1120 (erc-ignored-user-p),(erc-cmd-IGNORE),(erc-cmd-UNIGNORE): Now nicks are ignored
1121 on a per-server basis. Now, erc-ignore-list is only valid in server
1122 buffers! Do not reference it in channel buffers.
1123
1124 * erc.el(erc-cmd-IGNORE):
1125 Now says "Ignore list is empty" if it erc-ignore-list is empty
1126 instead of showing an empty list.
1127
11282003-01-25 Alex Schroeder <alex@gnu.org>
1129
1130 * erc-nickserv.el(services): Defined a module
1131
11322003-01-25 Jorgen Schaefer <forcer@users.sourceforge.net>
1133
1134 * erc.el(erc-process-ctcp-query):
1135 Display recipient of CTCP query if it's not
1136 our current nick.
1137
1138 * erc.el(erc-cmd-WHOIS):
1139 Accept an optional second argument SERVER.
1140
11412003-01-25 Alex Schroeder <alex@gnu.org>
1142
1143 * erc-stamp.el(stamp): erc-add-timestamp must always be added
1144 with the APPEND parameter -- not only when adding it on the right.
1145
11462003-01-24 Alex Schroeder <alex@gnu.org>
1147
1148 * erc-members.el(erc-channel-members-changed-hook): Obsolete, use
1149 erc-members-changed-hook instead. When it is set, add its content
1150 to erc-members-changed-hook.
1151 (erc-update-channel-member): Obsolete, use erc-update-member
1152 instead. Defalias to that effect.
1153 (erc-remove-channel-member): New and already obsolete. Use
1154 erc-remove-nick-from-channel instead.
1155 (erc-update-channel-info-buffer): Obsolete, use ignore instead.
1156 Yes, these have to go.
1157 (erc-channel-member-to-user-spec): Obsolete, use erc-format-user
1158 instead.
1159 (erc-format-user): New.
1160 (erc-ignored-reply-p): New, use it.
1161
1162 * erc-members.el:
1163 Further along the way. Any function from erc.el that uses
1164 channel-members should end up in this file, rewritten to use
1165 erc-members.
1166
1167 (erc-person): Call erc-downcase before getting
1168 something from the hash.
1169 (erc-nick-in-channel): Checking wether erc-process must be used is
1170 unnecessary -- this will be done in erc-person.
1171 (erc-nick-channels): New.
1172 (erc-add-nick-to-channel, erc-update-member): Call erc-downcase
1173 before putting something into the hash.
1174 (erc-buffer-list-with-nick): New.
1175 (erc-format-nick, erc-format-@nick): New, backwards incompatible.
1176 Must check for other places that call these!
1177 (erc-server-PRIVMSG-or-NOTICE): Use the new version.
1178
1179 * erc-compat.el(view-mode-enter): defalias to view-mode, if
1180 view-mode-enter is not fboundp and view-mode is -- as is the case
1181 in XEmacs. We need view-mode-enter in erc-match.el.
1182
11832003-01-23 Francis Litterio <franl@users.sourceforge.net>
1184
1185 * erc.el(erc-default-server-handler):
1186 Minor performance improvement: allow the lambda
1187 expression to be byte-compiled.
1188
11892003-01-23 Damien Elmes <erc@repose.cx>
1190
1191 * erc.el(erc-cmd-BANLIST):
1192 in the absence of a fill-column, use the screen width
1193
11942003-01-22 Damien Elmes <erc@repose.cx>
1195
1196 * erc.el:
1197 patch from MrBump to delay fetching the banlist until /bl is run, so we don't
1198 fetch it when joining a channel anymore
1199
1200 * erc-ring.el:
1201 * instead of adjusting hooks when loaded, provide (erc-ring-mode). you'll
1202 need to run (erc-ring-mode 1) now to get the ring
1203 * (erc-previous-command), (erc-next-command):
1204 - check if the ring exists and create it if necessary
1205 - don't do anything if the ring is empty
1206
1207 * erc-pcomplete.el:
1208 Put "how to use" documentation in the comments up the top
1209
12102003-01-21 Alex Schroeder <alex@gnu.org>
1211
1212 * erc-autojoin.el(erc-autojoin-version): New.
1213
1214 * erc-autojoin.el(erc-autojoin-add): Added body.
1215 (erc-autojoin-remove): Added body.
1216 (erc-autojoin): Provide it.
1217
12182003-01-21 Damien Elmes <erc@repose.cx>
1219
1220 * erc.el: erc-cmd-*: removed a bunch of references to force
1221
12222003-01-21 Alex Schroeder <alex@gnu.org>
1223
1224 * erc-autojoin.el(erc-autojoin-channels-alist): More doc.
1225
12262003-01-20 Alex Schroeder <alex@gnu.org>
1227
1228 * erc-autojoin.el:
1229 new, based on resolve's mail, and the stuff on the wiki
1230
1231 * erc-members.el: new
1232
12332003-01-19 Mario Lang <mlang@delysid.org>
1234
1235 * debian/README.Debian, debian/changelog, debian/scripts/install,
1236 debian/scripts/startup.erc, Makefile:
1237 Prepare for 20030119 debian package
1238
1239 * erc-dcc.el: <rant>
1240 * (erc-decimal-to-ip): Since XEmacs decides that return a completely
1241 and utterly wrong number from string-to-number if it is larger than
1242 the integer boundary, instead of sanely converting the thing to
1243 a float, we now (concat dec ".0").
1244 </rant>
1245
1246 * erc.el:
1247 * (erc-log-irc-protocol): Use erc-propertize, not propertize
1248
12492003-01-19 Alex Schroeder <alex@gnu.org>
1250
1251 * erc-button.el(erc-button-add-buttons): Added regexp-quote for
1252 the list case, too.
1253
12542003-01-19 Damien Elmes <erc@repose.cx>
1255
1256 * erc-dcc.el(erc-dcc-member): fix for case where a prop is nil
1257
1258 * erc-dcc.el(erc-dcc-member):
1259 fix for xemacs's version of plist-member
1260
12612003-01-19 Mario Lang <mlang@delysid.org>
1262
1263 * erc-notify.el: Delete empty strings from the ison-list
1264
1265 * erc-track.el:
1266 * (erc-track-switch-buffer): Call erc-modified-channels-update here.
1267
1268 * erc-track.el: * toplevel: require 'erc-match
1269
1270 * erc-track.el: * (erc-track-mode): Make autoload interactive
1271
1272 * erc-button.el: * (button): Make the autoload interactive
1273
1274 * erc.el:
1275 * (erc-mode): Comment out the case-table stuff, breaks xemacs
1276 * (erc-downcase): Revert.
1277
1278 * erc-dcc.el:
1279 * (erc-dcc-handle-ctcp-send): Use erc-decimal-to-ip on the ip we get...
1280
1281 * erc-speak.el:
1282 Eliminate reference to erc-nick-regexp, which no longer exists
1283
12842003-01-19 Alex Schroeder <alex@gnu.org>
1285
1286 * erc-stamp.el(erc-timestamp-right-column): New, default nil.
1287 (erc-insert-timestamp-right): Use it, if non-nil. Verbose
1288 doc string.
1289
12902003-01-18 Jorgen Schaefer <forcer@users.sourceforge.net>
1291
1292 * erc.el(erc-downcase): Use the old behavior in non-CVS Emacs.
1293
1294 * erc.el(erc-cmd-QUIT): Remove &rest. The correct fix follows.
1295 (erc-cmd-GQUIT): Pass "" to erc-cmd-QUIT.
1296 (erc-mode): Use the case-table only in CVS Emacs. See comment.
1297
1298 * erc.el(erc-cmd-QUIT): make reason optional.
1299
1300 * erc.el(erc-cmd-GQUIT): Fixed typo.
1301
13022003-01-17 Mario Lang <mlang@delysid.org>
1303
1304 * erc.el:
1305 * (erc-current-logfile): call expand-file-name, so that downcase doesn't mess up ~
1306
1307 * erc.el: * (erc-mode): Define a proper case-table.
1308 * (erc-downcase): just call downcase for now, lets see if the case-table is portable, if yes, we'll remove all erc-downcase references anyway...
1309
1310 * erc-button.el: * (erc-button-add-buttons): regex-quote the nick
1311
13122003-01-17 Alex Schroeder <alex@gnu.org>
1313
1314 * erc-button.el(button): erc-channel-members-changed-hook no
1315 longer has erc-recompute-nick-regexp.
1316 (erc-button-alist): Use channel-members instead of
1317 erc-nick-regexp.
1318 (erc-button-add-buttons): Split some code into
1319 erc-button-add-buttons-1, and now handle strings, lists, and
1320 alists. Regular expressions in lists and alists are enclosed in
1321 < and >.
1322 (erc-button-add-buttons-1): New.
1323 (erc-nick-regexp): Deleted.
1324 (erc-recompute-nick-regexp): Deleted.
1325
1326 * erc-button.el: Remove require cl again.
1327 (erc-mode-map): No longer bind widget-backward and widget-forward.
1328 (erc-button-alist): Explain why byte-compiling makes no sense, and
1329 remove all calls to byte-compile.
1330 (erc-button-keymap): Define it the standard way, without exposing
1331 the list nature of the keymap.
1332 (erc-button-marker-list): Deleted.
1333 (erc-button-add-buttons): Simplify. In particular, create the
1334 button using the real callback, instead of using the intermediate
1335 erc-button-push, and only store the data as described for
1336 erc-button-alist.
1337 (erc-button-remove-old-buttons): Simplify. No more list munging.
1338 Instead, just remove all the properties that we add in
1339 erc-button-add-button.
1340 (erc-widget-press-button): Deleted.
1341 (erc-button-click-button): New, for mouse clicks. Moves point to
1342 where the mouse is, and calls erc-button-push.
1343 (erc-button-push): Instead of matching again, just use the
1344 erc-callback and erc-data properties at point to do the right
1345 thing.
1346 (erc-button-entry): Deleted.
1347 (erc-button-next): Use error instead of the beep plus message
1348 combo.
1349
13502003-01-17 Jorgen Schaefer <forcer@users.sourceforge.net>
1351
1352 * erc-autoaway.el(erc-autoaway-set-back):
1353 Don't pass a force argument to erc-cmd-GAWAY.
1354
1355 * erc.el(erc-cmd-AWAY): Removed usage of the force variable.
1356
13572003-01-17 Alex Schroeder <alex@gnu.org>
1358
1359 * erc-button.el(button):
1360 erc-recompute-nick-regexp is no longer added to
1361 erc-channel-members-changed-hook unconditionally, but only if
1362 erc-button-mode is enabled, and if it is disabled, it is removed
1363 again.
1364 (erc): Require cl for delete-if.
1365 (erc-button-remove-old-buttons): Rewrote using delete-if to
1366 prevent exceesive consing. Having the marker list is still ugly,
1367 so another solution needs to be found.
1368
13692003-01-17 Jorgen Schaefer <forcer@users.sourceforge.net>
1370
1371 * erc.el(erc-banlist-store):
1372 Don't assume there's always a setter in the banlist reply.
1373
13742003-01-17 Alex Schroeder <alex@gnu.org>
1375
1376 * erc-button.el(erc-button-url-regexp): Changed regexp according
1377 to a suggestion by Max Froumentin <mf@w3.org>.
1378
13792003-01-17 Mario Lang <mlang@delysid.org>
1380
1381 * erc.el:
1382 fix erc-remove-channel-member again to not error out on nil as first arg...
1383
1384 * erc.el: * (erc-occur): New function
1385
13862003-01-17 Damien Elmes <erc@repose.cx>
1387
1388 * erc.el: erc-banlist-*: return nil so further hooks are called
1389
1390 * erc.el(erc-server-368):
1391 supress "end of ban list" messages - use /listbans now
1392
1393 * erc.el(erc-send-current-line):
1394 removed the check for leading whitespace again - the
1395 only time we want to prohibit multi-line commands is if / is the first
1396 thing on the line
1397 (erc-get-arglist): new defun for reading a function's arglist which should
1398 work with older copies of emacs. we use help-function-arglist if it's
1399 available, though, since that has support for reading subrs, etc
1400
1401 * erc.el(erc-cmd-JOIN): fixed (again)
1402
1403 * erc.el: * fixed call to erc-cmd-NICK when connecting
1404 * support for listing bans and mass unbanning, again thanks to MrBump
1405
1406 * erc.el(erc-set-topic):
1407 patch from MrBump (Mark Triggs, mst@dishvelled.net) to strip
1408 control chars and topic attribution in C-c C-t
1409
14102003-01-16 Mario Lang <mlang@delysid.org>
1411
1412 * erc.el:
1413 * (erc-remove-channel-member): Do not use delq, modify the list using setcdr like delq does.
1414 In theory, this should be way faster since the list doesnt get traverse two times.
1415 Measurement didn't show any real difference though :(, this system is flawed for channels with >300 users it seems...
1416 Also moved some defcustoms up.
1417
14182003-01-16 Brian P Templeton <bpt@tunes.org>
1419
1420 * erc.el: moved misplaced paren
1421
14222003-01-16 Damien Elmes <erc@repose.cx>
1423
1424 * erc.el(erc-cmd-UNIGNORE):
1425 reference argument directly - no string matching
1426
1427 * erc.el(erc-extract-command-from-line):
1428 hmm, thinko in the canonicalisation. should
1429 be fixed
1430
14312003-01-16 Francis Litterio <franl@users.sourceforge.net>
1432
1433 * erc.el(erc-send-current-line):
1434 Changed the regexp used to match /COMMANDs so that leading
1435 whitespace is taken into account.
1436
14372003-01-16 Mario Lang <mlang@delysid.org>
1438
1439 * erc-dcc.el: * (erc-dcc-do-SEND-command): Fix it
1440
1441 * erc-ezbounce.el, erc-lang.el: Arglist changes...
1442
1443 * erc.el: Various docstring fixes and additions.
1444
1445 * erc-notify.el:
1446 * (erc-cmd-NOTIFY): Change the function arglist to (&rest args)
1447
1448 * erc-netsplit.el: * (erc-cmd-WHOLEFT): Has no args...
1449
14502003-01-16 Damien Elmes <erc@repose.cx>
1451
1452 * erc-fill.el:
1453 erc-fill-column: default to 78, so things like docstrings don't get wrapped
1454 in an ugly manner
1455
14562003-01-16 Mario Lang <mlang@delysid.org>
1457
1458 * erc.el:
1459 * (erc-cmd-default): Take a substring, now /mode works again.
1460 * (erc-cmd-AWAY): Put do-not-parse-args t
1461 * (erc-cmd-GAWAY): Ditto, and fix it.
1462 * (erc-cmd-CTCP): Switch to argument system.
1463 * (erc-cmd-KICK): Do the same.
1464
14652003-01-15 Mario Lang <mlang@delysid.org>
1466
1467 * erc-dcc.el:
1468 * (erc-cmd-DCC): Fixed for the new scheme, simplified.
1469 * (erc-dcc-do-CHAT-command): Ditto.
1470 * (erc-dcc-do-CLOSE-command): Ditto.
1471 * (erc-dcc-do-LIST-command): Ditto.
1472
14732003-01-15 Damien Elmes <erc@repose.cx>
1474
1475 * erc.el:
1476 erc-error-face: setting a background doesn't work so well with multi-line
1477 messages, so we don't. fg colour is negotiable ;-)
1478 (erc-cmd-QUERY): fixed, new doco, supress (erc-delete-query) until we fix it
1479 (erc-send-current-line): allow multi-line messages provided they don't start
1480 with a slash - there's no need to prohibit them if the slash isn't the
1481 first character
1482
1483 * erc.el: * bad-syntax now reports like incorrect-args
1484 * bunch of extra cmds fixed, nick, sv etc.
1485
1486 * erc.el(erc-cmd-HELP): fixed
1487 (erc-extract-command-from-line): when deterimining canon-defun, make sure we
1488 have a valid symbol
1489 (erc-cmd-KICK): fixed
1490
1491 * erc.el:
1492 * removed duplicate do-no-parse-args properties for the defaliased defuns
1493 (erc-process-input-line): show function signature when incorrect args
1494 (erc-extract-command-from-line): canonicalise defaliases before extracting
1495 plist
1496 (erc-cmd-CLEAR): fixed
1497 (erc-cmd-UNIGNORE): fixed again
1498
1499 * erc.el(erc-cmd-SET): fixed
1500 (erc-cmd-UNIGNORE): fixed
1501 (erc-process-input-line): report when incorrect arguments are provided to a
1502 command, and show the command's docstring
1503
1504 * erc.el(erc-cmd-APPENDTOPIC): fixed
1505 (erc-process-input-line): more informative error message than 'bad syntax'
1506
15072003-01-15 Mario Lang <mlang@delysid.org>
1508
1509 * erc.el: * (erc-cmd-IGNORE): fixed
1510
1511 * erc.el: * (erc-cmd-NAMES): fixed
1512
1513 * erc.el:
1514 * (erc-cmd-CLEARTOPIC): Simplify, fix doc, make interactive
1515
15162003-01-15 Damien Elmes <erc@repose.cx>
1517
1518 * erc.el(erc-cmd-JOIN):
1519 correct invite behavior, and document it.
1520
15212003-01-15 Mario Lang <mlang@delysid.org>
1522
1523 * erc.el: * (erc-cmd-PART): Put 'do-not-parse-args t
1524
15252003-01-15 Damien Elmes <erc@repose.cx>
1526
1527 * erc.el(erc-cmd-JOIN): new cmd argument syntax
1528 (erc-process-input-line): check if (erc-extract-command-from-line) returned a
1529 list, and apply if that's the case
1530
1531 * erc.el:
1532 erc-cmd-*: remove optional force and references to `force' in the code
1533 (erc-cmd-AMSG): call erc-trim-string, not trim-string
1534
15352003-01-15 Mario Lang <mlang@delysid.org>
1536
1537 * erc.el:
1538 * (erc-cmd-CLEARTOPIC): LINE is now ARGS and already parsed.
1539 Set erc-cmd-TOPIC to 'do-not-parse-args for now.
1540 (comment: I think we should have 'first, so that only first word is parsed...
1541 Or we could autodetect erc-channel-p in the parser before that somehow...)
1542
1543 * erc.el: * (erc-cmd-OP): LINE is PEOPLE now, and already parsed.
1544
1545 * erc-notify.el:
1546 * (erc-cmd-NOTIFY): Arg LINE is now ARGS, and already parsed.
1547
15482003-01-15 Jorgen Schaefer <forcer@users.sourceforge.net>
1549
1550 * erc-stamp.el(erc-insert-timestamp-right):
1551 Prefer erc-fill-column to window-width,
1552 because on wide screens the timestamp could wander off too far to the
1553 right.
1554
15552003-01-15 Mario Lang <mlang@delysid.org>
1556
1557 * erc.el: This is the "everything is suddenly broken!" release
1558 You know, this is CVS, you can still go back, and wait until the transition
1559 is finished, but here is patch one, which basicly breaks every command
1560 which is typed on the prompt.
1561 Hit me, we can still revert, but something needs to be done about this.
1562 * (erc-extract-command-from-line): intern-soft the function here.
1563 If the function symbol has a property 'do-not-parse-args, operate as before,
1564 otherwise, split the arguments prior to calling the command handler.
1565 * (erc-process-input-line): Updated to accomodate the change above.
1566 * (erc-send-distinguish-noncommands): Ditto.
1567 * (erc-cmd-NAMES): Ditto.
1568 * (erc-cmd-ME): Put 'do-not-parse-args property.
1569
1570 * erc-dcc.el:nick: * erc-dcc.el: * erc-dcc-list: Renamed
1571 * (erc-dcc-member). Treat :nick as either a nick!user@host or nick,
1572 do appropriate comparisons, simplified.
1573 * (erc-dcc-list-add): New functions
1574 various callers of (cons (list ...) erc-dcc-list) updated.
1575 Other stuff I'm to bored to document now
1576
15772003-01-15 Jorgen Schaefer <forcer@users.sourceforge.net>
1578
1579 * erc-stamp.el(erc-insert-timestamp-right):
1580 Removed redundant code that overrid the
1581 window-width. Now substracts (length string) from every found
1582 indentation positions.
1583
15842003-01-14 Mario Lang <mlang@delysid.org>
1585
1586 * erc.el:
1587 * (erc-cmd-AMSG): Remove useless call to erc-display-message.
1588
1589 * erc-dcc.el:
1590 * erc-dcc-chat/send-request: New variables, control how to treat
1591 incoming dcc chat or send requests. Can be set to 'ask, which behaves
1592 like it did before, 'auto, which accepts automatically, and
1593 'ignore, which ignores those type of requests completely.
1594 * (erc-cmd-CREQ): New user-level command.
1595 * (erc-cmd-SREQ): Ditto.
1596
1597 * erc.el: * (erc-cmd-AMSG). New command.
1598
1599 * erc-xdcc.el: * (erc-xdcc): delete empty strings from ARGS
1600
1601 * erc-dcc.el: * erc-dcc-ipv4-regexp: New constant
1602 * (erc-ip-to-decimal): Use it.
1603 * erc-dcc-host:valid-regexp erc-dcc-ipv4-regexp: * erc-dcc-host: :type
1604 * (pcomplete/erc-mode/DCC): Add completion for GET and CLOSE.
1605 * Some docstring/comment fixes.
1606
1607 * erc-stamp.el:
1608 * (erc-insert-timestamp-right): Subtract (length string) from
1609 POS in any case, otherwise, linewrap occurs.
1610
1611 * erc-dcc.el:
1612 * Fixed the unibyte-multibyte problem (now a dcc get buffer is (set-buffer-multibyte nil),
1613 and saves correctly (tried with 21.3.50). Thanks to Eli for suggesting it!
1614 * Added :start-time plist property/value to GET handling so that we can calculate elapsed-time.
1615 * Some (unwind-protect (progn (set-buffer ...) ...)) constructs replaced with (with-current-buffer ...)
1616
16172003-01-13 Mario Lang <mlang@delysid.org>
1618
1619 * erc-xdcc.el:
1620 * erc-xdcc-help-text: New variable which makes replies to the originator
1621 much more flexible.
1622 * erc-xdcc-help-format: Removed.
1623 * (erc-xdcc-help): Handle the new variable.
1624 * (erc-xdcc): Simplified
1625
1626 * erc-xdcc.el: * erc-xdcc-handler-alist: New variable.
1627 * (erc-xdcc): Move code for list and send sub-commands into
1628 * (erc-xdcc-help): New function.
1629 * (erc-xdcc-list): New function.
1630 * (erc-xdcc-send): New function.
1631
16322003-01-12 Jorgen Schaefer <forcer@users.sourceforge.net>
1633
1634 * erc.el(erc-server-JOIN):
1635 Oops, send MODE command only when *we* joined a channel.
1636
1637 * erc.el:
1638 Fixing ERCs behavior wrt IRCnet's !channels have a different name for
1639 JOIN than in reality (e.g. you can join !forcertest or !!forcertest
1640 and really get to !ABCDEforcertest)
1641
1642 (erc-cmd-JOIN): Removed erc-send-command MODE.
1643 (erc-server-JOIN): Ask for MODE now.
1644
16452003-01-12 Damien Elmes <erc@repose.cx>
1646
1647 * erc-dcc.el:
1648 (erc-dcc-get-filter), (erc-dcc-get-file): store size as a string, not an
1649 integer. check size > 0 for the case where a size wasn't provided, since
1650 string-to-int will return 0 on an empty string
1651
16522003-01-12 Mario Lang <mlang@delysid.org>
1653
1654 * erc-dcc.el: * Use RAWFILE arg with find-file-noselect
1655 * Fix alist/plist conversion left-over
1656 * Add verbose-info about sending blocks.
1657
16582003-01-11 Mario Lang <mlang@delysid.org>
1659
1660 * erc-dcc.el: * (pcomplete-erc-mode/DCC): Fixes
1661
1662 * erc-xdcc.el: Initial version.
1663
1664 * erc-pcomplete.el:
1665 * (erc-pcomplete): Fix so that cycle-completion works again.
1666 * (pcomplete-parse-erc-arguments): If there is a space after the last word
1667 before point, we need to return a "" arg, and it's position.
1668
1669 * erc-dcc.el: Fix to pcomplete/erc-mode/DCC
1670
1671 * erc-dcc.el: * (pcomplete/erc-mode/DCC): New function
1672
1673 * erc-dcc.el: *** empty log message ***
1674
1675 * erc-dcc.el: Move code around, just basic changes
1676
16772003-01-11 Jorgen Schaefer <forcer@users.sourceforge.net>
1678
1679 * erc-stamp.el(erc-insert-timestamp-right):
1680 Check wether erc-fill-column is
1681 available before using it. Else default to fill-column or if
1682 everything else fails, the window width of the current window. For the
1683 fill-columns, use them directly as the starting position for the
1684 timestamp.
1685
16862003-01-11 Andreas Fuchs <asf@void.at>
1687
1688 * erc-stamp.el:
1689 erc-insert-timestamp-right: use correct window's window-width. If
1690 buffer is not in a window, use erc-fill-column.
1691
16922003-01-11 Mario Lang <mlang@delysid.org>
1693
1694 * erc-dcc.el: * erc-dcc.el: * (erc-dcc-do-LIST-command): Fix
1695
1696 * erc-dcc.el:
1697 * buffer-local variables erc-dcc-sent-marker and erc-dcc-send-confirmed marker removed
1698 Keep This info in erc-dcc-member :sent and :confirmed plist values
1699 * : * :buffer plist for :type 'SEND removed, since we can get this with (marker-buffer
1700 * erc-dcc-send-connect-hook: New hook, defaults to erc-dcc-send-block and erc-dcc-send-conntected, which now prints a msg...
1701
1702 * erc-dcc.el:
1703 * (erc-dcc-chat-accept): Renamed from erc-dcc-chat. Callers updated.
1704 * (erc-dcc-chat): Renamed from erc-dcc-chat-request.
1705 Callers updated, and interactive form added.
1706 * (erc-dcc-server-accept): No longer do any type-specific stuff.
1707 * (erc-dcc-chat-sentinel): Call erc-dcc-chat-setup if event is "open from "
1708 from here, otherwise call erc-dcc-chat-close.
1709
1710 * (
1711
1712 * erc-dcc.el: *** empty log message ***
1713
1714 * erc-dcc.el: Moved some functions around.
1715 Doc string fixes.
1716 "/dcc send nick filename" works now
1717
17182003-01-11 Alex Schroeder <alex@gnu.org>
1719
1720 * erc.el(erc-send-command): Fixed flood protect message.
1721
1722 * erc-button.el(erc-button-syntax-table): Make `-' a legal nick
1723 constituent.
1724
17252003-01-10 Mario Lang <mlang@delysid.org>
1726
1727 * erc-dcc.el: Some more steps toward dcc send.
1728
17292003-01-10 Francis Litterio <franl@users.sourceforge.net>
1730
1731 * erc-notify.el(erc-notify-timer):
1732 Changed to make it IRC-case-insensitive when comparing nicks.
1733 (erc-notify-JOIN): Changed to make it IRC-case-insensitive when comparing nicks.
1734 (erc-notify-NICK): Changed to make it IRC-case-insensitive when comparing nicks.
1735 (erc-notify-QUIT): Changed to make it IRC-case-insensitive when comparing nicks.
1736 (erc-cmd-NOTIFY): Now "/notify -l" lists the nicks on your notify list. Now
1737 when you remove a nick from your notify list, you no longer recieve a spurious
1738 signoff notification for that nick. Changed to make it IRC-case-insensitive when
1739 comparing nicks.
1740
1741 * erc.el(erc-ison-p):
1742 Fixed so it calls erc-member-ignore-case instead of member.
1743
1744 * erc.el(erc-member-ignore-case):
1745 New function. Just like member-ignore-case, but obeys
1746 the IRC protocol case matching rules.
1747
17482003-01-10 Damien Elmes <erc@repose.cx>
1749
1750 * erc-dcc.el:
1751 (erc-dcc-do-GET-command), (erc-dcc-get-file): use the plist syntax, this
1752 fixes dcc get again
1753
17542003-01-10 Jorgen Schaefer <forcer@users.sourceforge.net>
1755
1756 * erc.el: erc-complete-functions: New variable.
1757 erc-mode-map: Bind \t to 'erc-complete-word
1758 erc-complete-word: New function.
1759
1760 * erc-pcomplete.el(erc-pcomplete-mode):
1761 Use new erc-complete-functions
1762 (erc-pcomplete): Check that we're in the input line, else return nil.
1763
1764 * erc-button.el(erc-button-mode): Use new erc-complete-functions
1765 erc-button-old-tab-command: Removed.
1766 (erc-button-next-or-old): Removed
1767 (erc-button-next): check that we're not in the input line, else just return nil.
1768
17692003-01-10 Mario Lang <mlang@delysid.org>
1770
1771 * erc-dcc.el: cleanup
1772
1773 * erc-dcc.el:
1774 * (erc-dcc-chat-request): No longer use erc-send-ctcp-message.
1775
1776 * erc-dcc.el:
1777 * (erc-dcc-no-such-nick): Also call delete-process if we have a peer already
1778
1779 * erc-dcc.el:
1780 * (erc-dcc-no-such-nick): New function, server event handler for event 401.
1781 If we send a CTCP message requesting something dcc related, we set up an
1782 entry in erc-dcc-list before sending the request (for the server proc object
1783 for listening conns for example). But if that nick does not exist
1784 on that server, we now nicely cleanup erc-dcc-list again.
1785
17862003-01-09 Mario Lang <mlang@delysid.org>
1787
1788 * erc-dcc.el: Moved code around a bit, and doc fixes
1789
1790 * erc-dcc.el: *** empty log message ***
1791
1792 * erc-dcc.el: Rename erc-dcc-plist to erc-dcc-list
1793
17942003-01-09 Damien Elmes <erc@repose.cx>
1795
1796 * erc-dcc.el(erc-dcc-server (erc-dcc-chat-setup):
1797 use erc's (erc-setup-buffer) to determine how to
1798 display new DCC windows
1799 (erc-dcc-chat-buffer-killed): buffer-local hook for DCC buffers to close the
1800 process
1801 (erc-dcc-chat-close): code common to a killed buffer or a disconnection from
1802 the other side
1803 (erc-dcc-chat-sentinel): use (erc-dcc-chat-close)
1804 (erc-dcc-server-accept): use (erc-log) instead of (message)
1805
1806 * erc.el:
1807 (erc), (erc-setup-buffer): factor out window generation code so DCC can use
1808 it too
1809
1810 * erc-dcc.el:
1811 (erc-dcc-do-CLOSE-command), (erc-dcc-do-LIST-command): work with erc-dcc-plist
1812
1813 * erc-dcc.el:
1814 erc-dcc-alist: became erc-dcc-plist, so we can more easily grab particular
1815 properties
1816 dcc catalog: unify use of DCC: and [dcc] (either's fine, but let's be
1817 consistent)
1818 (erc-dcc-member): takes an arbitrary list of constraints now
1819 (erc-dcc-proc-member): removed, as (erc-dcc-member) can be used for this
1820 (erc-dcc-do-CHAT-command): use the catalog to show the user what's going on
1821 (erc-dcc-chat-server): removed
1822 (erc-dcc-server): takes name sentinel and filter arguments, can be used for
1823 both send and chat now
1824
1825 .. this release means all send/get support is broken until we fix up the
1826 things that still expect to be using an alist. this include /dcc list, /dcc
1827 close
1828
18292003-01-09 Francis Litterio <franl@users.sourceforge.net>
1830
1831 * erc-ring.el(erc-previous-command):
1832 If you have a partially typed input line and press M-p,
1833 you lose what you typed. Now we save it so you can come back to it.
1834
18352003-01-09 Jorgen Schaefer <forcer@users.sourceforge.net>
1836
1837 * erc-ring.el(erc-add-to-input-ring): s/nullp/null/
1838
18392003-01-09 Damien Elmes <erc@repose.cx>
1840
1841 * erc-ring.el(erc-add-to-input-ring):
1842 set up the ring if it's not already setup
1843
1844 * erc-dcc.el(erc-dcc-member): case insensitive match of nicknames
1845 (erc-dcc-do-CHAT-command): echo what we're doing (at least for now)
1846
18472003-01-09 Mario Lang <mlang@delysid.org>
1848
1849 * erc-dcc.el: (temporarily) fix erc-process setting...
1850
1851 * erc-dcc.el: * (erc-dcc-chat-send-line): Removed
1852
1853 * erc.el:
1854 Check if target is stringp (we can now also have 'dcc as value...)
1855
1856 * erc-dcc.el(erc-dcc-chat-send-input-line):
1857 New function, used for
1858 erc-send-input-line-function.
1859 Use erc-send-current-line now.
1860
1861 * erc-dcc.el: evt to elt...
1862
1863 * erc-dcc.el: Remove () from a var (how silly!)
1864
1865 * erc-dcc.el: * (erc-dcc-get-host): Use format-network-address.
1866 * (erc-dcc-host): Change semantic. If erc-dcc-host is set, use it.
1867 Otherwise, try to figure out the host by calling erc-dcc-get-host.
1868 * (erc-dcc-server-port): New variable.
1869 * erc-dcc-chat-log: Renamed to erc-dcc-server-accept
1870
1871 * erc-dcc.el(erc-dcc-do-CHAT-command):
1872 Change arg of call to erc-dcc-chat-request from elt to nick
1873
18742003-01-09 Francis Litterio <franl@users.sourceforge.net>
1875
1876 * erc.el(erc-send-current-line):
1877 Now rejects multi-line commands (i.e., lines that
1878 start with "/" and contain newlines).
1879
18802003-01-09 Jorgen Schaefer <forcer@users.sourceforge.net>
1881
1882 * erc-button.el:
1883 Functionality to use TAB to jump to the next button:
1884
1885 (erc-button-next-or-old): New function.
1886 (erc-button-next): New function.
1887 erc-button-keymap: added erc-button-next
1888 erc-button-old-tab-command: New variable.
1889 define-erc-module button: Add and remove 'erc-button-next-or-old as
1890 appropriate.
1891
18922003-01-09 Francis Litterio <franl@users.sourceforge.net>
1893
1894 * erc.el:
1895 New variable: erc-auto-reconnect (defaults to t). If non-nil, ERC will
1896 automatically reconnect to a server after an unexpected disconnection.
1897 (erc-process-sentinel): Changed to refer to variable erc-auto-reconnect.
1898
18992003-01-08 Mario Lang <mlang@delysid.org>
1900
1901 * erc.el:
1902 * erc-send-input-line-function: New variable, used for dispatch...
1903
19042003-01-08 Damien Elmes <erc@repose.cx>
1905
1906 * erc-dcc.el(erc-dcc-chat-sentinel):
1907 check event type before killing process
1908 (erc-dcc-chat-log): new, handles the setup of dcc chats for incoming
1909 connections
1910 (erc-dcc-chat): use (erc-dcc-chat-setup)
1911 (erc-dcc-chat-setup): code common to incoming and outgoing DCC chats
1912 (erc-dcc-chat-request): request a DCC chat with another user
1913 (erc-dcc-proc-member): locate a member in erc-dcc-alist by process
1914
1915 The very first ERC to ERC DCC chat was held between delysid and resolve today!
1916
19172003-01-08 Mario Lang <mlang@delysid.org>
1918
1919 * erc-track.el(erc-all-buffer-names):
1920 Check for erc-dcc-chat-mode too
1921
19222003-01-08 Francis Litterio <franl@users.sourceforge.net>
1923
1924 * erc-ring.el, erc.el(erc-kill-input):
1925 Resets erc-input-ring-index to nil, so that invoking this
1926 command conceptually puts you after your most recent input in the input
1927 history.
1928 (erc-previous-command and erc-next-command): Changed so that history movement
1929 is more intuitive. Also preserves the blank input line that marks the
1930 place after the newest command in the history ring (i.e., you'll see a
1931 blank command once every trip around the ring in either direction).
1932
19332003-01-08 Mario Lang <mlang@delysid.org>
1934
1935 * erc-dcc.el(erc-dcc-chat): Add docstring
1936 Add self-test.
1937 Fix error if /dcc chat nick doesnt find the nick
1938
19392003-01-08 Francis Litterio <franl@users.sourceforge.net>
1940
1941 * Makefile:
1942 Changed so that "make" works correctly under Cygwin. Before this change, the
1943 pathname passed to Emacs on the command line under Cygwin had the form
1944 "/cygwin/c/...", which prevented emacs from finding the file. Now the pathname
1945 has the form "c:/...". This works for any drive letter.
1946
19472003-01-08 Mario Lang <mlang@delysid.org>
1948
1949 * erc-button.el: reindent some code, and add TODO to comments
1950
1951 * erc-dcc.el: *** empty log message ***
1952
1953 * erc-dcc.el: Make dcc-chat-ended a notice
1954 Remove now bogus comment
1955
19562003-01-08 Damien Elmes <erc@repose.cx>
1957
1958 * erc-dcc.el(erc-pack-int): from erc-packed-int
1959 (erc-unpack-int): new
1960
1961 * erc-dcc.el(erc-unpack-str): added
1962
19632003-01-08 Mario Lang <mlang@delysid.org>
1964
1965 * erc.el(erc-server-482):
1966 New handler, handles KICK reply if you're not channel-op
1967
1968 * erc-dcc.el: Document SEND in erc-dcc-alist.
1969 Move sproc, parent-proc and file into erc-dcc-alist
1970
1971 * erc-dcc.el: stubs
1972
1973 * erc-dcc.el(erc-dcc-get-host):
1974 Change :iface to :local since Kim committed it now to CVS emacs
1975
1976 * erc-dcc.el(erc-dcc-get-host):
1977 New function, requires the not-yet-in-CVS-emacs local-address.patch to process.c.
1978 Some other minor additions
1979
19802003-01-08 Francis Litterio <franl@users.sourceforge.net>
1981
1982 * erc.el(erc-cmd-IGNORE):
1983 Now returns t to prevent "Bad syntax" error.
1984 (erc-cmd-UNIGNORE): Now returns t to prevent "Bad syntax" error.
1985 (erc-server-PRIVMSG-or-NOTICE): Capitalized first word in message to user.
1986
1987 * erc.el(erc-scroll-to-bottom):
1988 Temporarilly bind resize-mini-windows to nil so that
1989 users who have it set to a non-nil value will not suffer from premature
1990 minibuffer shrinkage due to the below recenter call. I have no idea why
1991 this works, but it solves the problem, and has no negative side effects.
1992
19932003-01-07 Jorgen Schaefer <forcer@users.sourceforge.net>
1994
1995 * erc-dcc.el:
1996 erc-dcc-ctcp-query-chat-regexp: The IP is not really an IP, but a
1997 number (no . allowed there).
1998 (erc-dcc-send-ctcp-string): use let* here to avoid cluttering up the
1999 match data.
2000 Also, use erc-decimal-to-ip to get the IP.
2001 (erc-ip-to-decimal): Removed some pasted ERC timestamps
2002 (erc-decimal-to-ip): New function.
2003 erc-dcc-chat-mode-map: Return map in the initialization.
2004
20052003-01-07 Francis Litterio <franl@users.sourceforge.net>
2006
2007 * erc-match.el(erc-match-fool-p):
2008 Changed to call erc-match-directed-at-fool-p instead of
2009 erc-directed-at-fool-p.
2010
20112003-01-07 Mario Lang <mlang@delysid.org>
2012
2013 * erc-dcc.el(erc-cmd-DCC):
2014 Change (cond ... (t nil)) to (when ...)
2015
2016 * erc-dcc.el: Use erc-current-nick-p
2017
20182003-01-07 Jorgen Schaefer <forcer@users.sourceforge.net>
2019
2020 * erc.el:
2021 erc-join-buffer: Added 'window-noselect to docstring and :type.
2022 erc-auto-query: Added 'window-noselect to :type.
2023 (erc): Treat erc-join-buffer being 'window-noselect appropriately.
2024
2025 * erc.el(erc-current-nick-p): New function.
2026 (erc-nick-equal-p): New function.
2027 (erc-already-logged-in), (erc-server-JOIN), (erc-auto-query),
2028 (erc-server-PRIVMSG-or-NOTICE): Use erc-current-nick-p.
2029 (erc-update-channel-member): Use erc-nick-equal-p.
2030
2031 * erc-match.el(erc-match-current-nick-p):
2032 Renamed from erc-current-nick-p
2033 (erc-match-pal-p): Renamed from erc-pal-p
2034 (erc-match-fool-p): Renamed from erc-fool-p
2035 (erc-match-keyword-p): Renamed from erc-keyword-p
2036 (erc-match-dangerous-host-p): Renamed from erc-dangerous-host-p
2037 (erc-match-directed-at-fool-p): Renamed from erc-directed-at-fool-p
2038 (erc-match-message): Use erc-match-TYPE-p instead of erc-TYPE-p
2039
2040 * erc.el:
2041 Support for IRCnets' "nick/channel temporarily unavailable"
2042
2043 (erc-nickname-in-use): New function (mostly copied from erc-server-433).
2044 (erc-server-433): Use erc-nickname-in-use
2045 (erc-server-437): New function.
2046 erc-server-hook-list: Added (437 erc-server-437).
2047
20482003-01-07 Mario Lang <mlang@delysid.org>
2049
2050 * erc-fill.el: Add autoload cookie
2051
2052 * erc-notify.el:
2053 Now also pass SERVER argument to signon/off hooks, and provide a erc-notify-signon/off function for echo-area printing
2054
2055 * erc-notify.el(erc-notiy-QUIT):
2056 Change use of delq to delete, delq does not work with strings
2057
20582003-01-06 Jorgen Schaefer <forcer@users.sourceforge.net>
2059
2060 * erc.el(erc-ctcp-query-VERSION):
2061 v%s -> %s, so we are no longer vVersion...
2062
20632003-01-06 Mario Lang <mlang@delysid.org>
2064
2065 * erc.el: Small change to erc-ison-p, and fixme tag
2066
20672003-01-06 Francis Litterio <franl@users.sourceforge.net>
2068
2069 * erc.el(erc):
2070 Fixed bug where variable "away" would be nil in new channel buffers
2071 even if the user is away when joining the channel.
2072 (erc-strip-controls): Fixed a bug where erc-strip-controls accidentally
2073 removed all text properties from the string.
2074
20752003-01-06 Mario Lang <mlang@delysid.org>
2076
2077 * erc-dcc.el:
2078 Some stub functions, some code, nothing really works yet
2079
2080 * erc.el(erc-ison-p): New function
2081
2082 * erc-dcc.el: Some functions which will be needed for dcc send
2083
2084 * erc-dcc.el(erc-ip-address-to-decimal):
2085 New function, thanks lawrence
2086
2087 * erc-dcc.el: Again, simplify code, fix stuff, DCC CHAT works now
2088
2089 * erc-dcc.el: Many fixes, chat nearly works now
2090
2091 * erc-netsplit.el: Also detect fast netsplit/joins
2092
2093 * erc-dcc.el: some more fixes
2094
2095 * erc-dcc.el: Fixup stage 1, now dcc get works
2096
2097 * erc-dcc.el: make /dcc LIST work
2098
2099 * erc-dcc.el:
2100 Initial checkin, dont use it! its really far from complete. Hackers: help!
2101
2102 * erc-notify.el:
2103 New function erc-notify-NICK, and added signon/off hooks which were missing
2104
21052003-01-05 Jorgen Schaefer <forcer@users.sourceforge.net>
2106
2107 * erc.el(erc-truncate-buffer-to-size):
2108 set inhibit-read-only to t for the
2109 deletion. This is usually done by the function calling the hook, but
2110 not if it's called interactively. Also, rewrote some weird if/if
2111 combination.
2112
2113 * erc-track.el(erc-track-shortennames):
2114 Documentation fix (erc-all-buffers is really
2115 erc-all-buffer-names)
2116
2117 These changes make server buffers be tracked as well, as there are
2118 quite a few interesting things going on there (e.g. CTCP etc.)
2119 (erc-all-buffer-names): Check for (eq major-mode 'erc-mode) instead of
2120 erc-default-recipients.
2121 (erc-track-modified-channels): Don't require a default target (e.g.,
2122 this-channel being non-nil)
2123
21242003-01-03 Damien Elmes <erc@repose.cx>
2125
2126 * erc.el:
2127 erc-auto-query: can now be set to a symbol to control how new messages should
2128 be popped up (or not popped up, as the case may be)
2129 (erc-query): new function which handles the bulk of what (erc-cmd-QUERY) did
2130 previously
2131 (erc-cmd-QUERY): use (erc-query)
2132 (erc-auto-query): use (erc-query)
2133
2134 * erc.el(erc-current-logfile):
2135 Downcase result of log generation function, as IRC is
2136 case insensitive. Fixes problems where "/query user" results in a different
2137 log file to a query from "User". Avoided adding an extra flag to control this
2138 behavior - if you think this was the wrong decision, please correct it and
2139 I'll remember it for next time.
2140
2141 Copyright (C) 2003 Free Software Foundation, Inc.
2142 Copying and distribution of this file, with or without modification,
2143 are permitted provided the copyright notice and this notice are preserved.
2144
2145;; arch-tag: 808865e1-3cce-4c5b-9997-95a8b7a9d384
diff --git a/lisp/erc/ChangeLog.2004 b/lisp/erc/ChangeLog.2004
new file mode 100644
index 00000000000..2a5ce9ef458
--- /dev/null
+++ b/lisp/erc/ChangeLog.2004
@@ -0,0 +1,2074 @@
12004-12-29 Francis Litterio <franl@users.sourceforge.net>
2
3 * erc-goodies.el (erc-interpret-controls-p): Changed docstring to
4 reflect the new meaning if this is set to 'remove.
5 (erc-controls-interpret): Rephrased docstring to be more accurate.
6 (erc-controls-strip): New function that behaves like the
7 recently-removed erc-strip-controls -- it removes all IRC color
8 and highlighting control characters.
9 (erc-controls-highlight): Changed to support the new 'remove value
10 that variable erc-interpret-controls-p might have.
11
122004-12-28 Francis Litterio <franl@users.sourceforge.net>
13
14 * erc-ibuffer.el, erc-list.el, erc-page.el, erc-speedbar.el:
15 Changed all calls to erc-interpret-controls (which no longer
16 exists) to call erc-controls-interpret (the new name of the same
17 function).
18
192004-12-28 Francis Litterio <franl@users.sourceforge.net>
20
21 * erc-goodies.el (erc-controls-interpret): Added this function to
22 replace the recently-removed erc-interpret-controls. Also added
23 a (require 'erc) to solve a byte-compile problem.
24
252004-12-28 Francis Litterio <franl@users.sourceforge.net>
26
27 * erc.el (erc-controls-interpret): Added this function to replace
28 the recently-removed erc-interpret-controls.
29
302004-12-27 Jorgen Schaefer <forcer@users.sourceforge.net>
31
32 * erc-truncate.el (erc-truncate-buffer-to-size): Check for
33 logging even better (via lawrence).
34
352004-12-26 Jorgen Schaefer <forcer@users.sourceforge.net>
36
37 * erc-truncate.el (erc-truncate-buffer-to-size): Much saner
38 logging detection (via lawrence).
39
402004-12-25 Jorgen Schaefer <forcer@users.sourceforge.net>
41
42 * erc-goodies.el (erc-controls-highlight): Treat single C-c
43 correctly.
44
452004-12-24 Jorgen Schaefer <forcer@users.sourceforge.net>
46
47 * erc-goodies.el, erc.el: Deleted IRC control character processing
48 and implemented a sane version in erc-goodies.el as a module.
49
50 * erc.el (erc-merge-controls, erc-interpret-controls,
51 erc-decode-controls, erc-strip-controls, erc-make-property-list,
52 erc-prepend-properties): Removed.
53
54 (erc-interpret-controls-p, erc-interpret-mirc-color, erc-bold-face
55 erc-inverse-face, erc-underline-face, fg:erc-color-face0,
56 fg:erc-color-face1, fg:erc-color-face2, fg:erc-color-face3,
57 fg:erc-color-face4, fg:erc-color-face5, fg:erc-color-face6,
58 fg:erc-color-face7, fg:erc-color-face8, fg:erc-color-face9,
59 fg:erc-color-face10, fg:erc-color-face11, fg:erc-color-face2,
60 fg:erc-color-face13, fg:erc-color-face14, fg:erc-color-face15,
61 bg:erc-color-face1, bg:erc-color-face2, bg:erc-color-face3,
62 bg:erc-color-face4, bg:erc-color-face5, bg:erc-color-face6,
63 bg:erc-color-face7, bg:erc-color-face8, bg:erc-color-face9,
64 bg:erc-color-face10, bg:erc-color-face11, bg:erc-color-face2,
65 bg:erc-color-face13, bg:erc-color-face14, bg:erc-color-face15,
66 erc-get-bg-color-face, erc-get-fg-color-face,
67 erc-toggle-interpret-controls): Moved.
68
69 * erc-goodies.el (erc-beep-p, irccontrols, erc-controls-highlight,
70 erc-controls-propertize): New.
71
722004-12-24 Jorgen Schaefer <forcer@users.sourceforge.net>
73
74 * erc-goodies.el, erc.el: The Small Extraction of Stuff[tm] commit.
75 Moved some functions from erc.el to erc-goodies.el, and
76 transformed them to erc modules in the process.
77 - imenu autoload stuff moved. I don't know why it is here at all.
78 - Moved: scroll-to-bottom, make-read-only, distinguish-noncommands,
79 smiley, unmorse, erc-occur (the last isn't a module, but still
80 moved)
81 (erc-input-line-position, erc-add-scroll-to-bottom,
82 erc-scroll-to-bottom, erc-make-read-only, erc-noncommands-list,
83 erc-send-distinguish-noncommands, erc-smiley, erc-unmorse,
84 erc-occur): Moved from erc.el to erc-goodies.el.
85 (smiley): Module moved from erc.el to erc-goodies.el.
86 (scrolltobottom, readonly, noncommands, unmorse): New modules.
87
882004-12-20 Diane Murray <disumu@x3y2z1.net>
89
90 * erc.el: (erc-format-away-status): Use `a', not `away' - that's
91 why it's there.
92 (erc-update-mode-line-buffer): The values of `mode-line-process'
93 and `mode-line-buffer-identification' are normally lists.
94 Conform.
95
962004-12-18 Jorgen Schaefer <forcer@users.sourceforge.net>
97
98 * erc.el: (erc-process-ctcp-query, erc-process-ctcp-reply): Display
99 message in the active window, not the server window.
100
1012004-12-16 Edward O'Connor <ted@oconnor.cx>
102
103 * erc-track.el (erc-track-position-in-mode-line): Check for
104 'erc-track-mode variable with boundp. From Adrian Aichner
105 <adrian@xemacs.org>.
106
1072004-12-16 Jorgen Schaefer <forcer@users.sourceforge.net>
108
109 * erc.el (erc-upcase-first-word): New function. The old way used
110 in erc-send-ctcp-message would eat consecutive whitespace etc.
111 (erc-send-ctcp-message, erc-send-ctcp-notice): Use it.
112
1132004-12-15 Edward O'Connor <ted@oconnor.cx>
114
115 * erc.el (erc-send-ctcp-message): Fix braino with my previous
116 patch. It always helps to C-x C-s before `cvs commit'.
117
1182004-12-15 Edward O'Connor <ted@oconnor.cx>
119
120 * erc.el (erc-send-ctcp-message): Only upcase the ctcp command,
121 and not the entire message. Brian Palmer's change of 2004-12-12 had broken /me.
122 Shouting is bad! :)
123
1242004-12-14 Diane Murray <disumu@x3y2z1.net>
125
126 * erc-nets.el (erc-networks-alist): Change undernet to Undernet as
127 is used in `erc-server-alist', so that completion works when using
128 `erc-server-select'. This should fix Debian bug #282003 (erc:
129 cannot connect to Undernet).
130
1312004-12-14 Diane Murray <disumu@x3y2z1.net>
132
133 * erc-backend.el: (def-edebug-spec): Only run this if 'edebug is
134 available.
135
1362004-12-14 Diane Murray <disumu@x3y2z1.net>
137
138 * erc.el: The last change to `erc-mode-line-format' introduced a
139 bug in Xemacs - it can't handle the #(" "...) strings at all. The
140 following changes fix the bug and simplify the mode-line handling
141 considerably. (erc-mode-line-format): Now defined as a string
142 which will be formatted using `format-spec' and take the place of
143 `mode-line-buffer-identification' in the mode line.
144 (erc-header-line-format): Now defined as a string to be formatted
145 using `format-spec'.
146 (erc-prepare-mode-line-format): Removed.
147 (erc-format-target, erc-format-target-and/or-server,
148 erc-format-away-status, erc-format-channel-modes): New functions.
149 Basically the old `erc-prepare-mode-line-format' split apart.
150 (erc-update-mode-line-buffer): Set
151 `mode-line-buffer-identification' to the formatted
152 `erc-mode-line-format', set `mode-line-process' to ": CLOSED" if
153 the connection has been terminated, and set `header-line-format'
154 (if it is bound) to the formatted `erc-header-line-format', then
155 do a `force-mode-line-update'.
156
1572004-12-12 Diane Murray <disumu@x3y2z1.net>
158
159 * erc.el (erc-modules): Disable modules removed with `customize'.
160 (erc-update-modules): Try to give a more descriptive error
161 message.
162
1632004-12-12 Diane Murray <disumu@x3y2z1.net>
164
165 * erc-complete.el, erc.el, erc-list.el, erc-nets.el,
166 erc-nicklist.el, erc-pcomplete.el, erc-replace.el, erc-speak.el,
167 erc-truncate.el: (erc-buffers, erc-coding-systems, erc-display,
168 erc-mode-line-and-header, erc-ignore, erc-query,
169 erc-quit-and-part, erc-paranoia, erc-scripts, erc-old-complete,
170 erc-list, erc-networks, erc-nicklist, erc-pcomplete, erc-replace,
171 erc-truncate): New customization groups. (erc-join-buffer,
172 erc-frame-alist, erc-frame-dedicated-flag, erc-reuse-buffers): Use
173 'erc-buffers as `:group'. (erc-default-coding-system,
174 erc-encoding-coding-alist): Use 'erc-coding-systems as `:group'.
175 (erc-hide-prompt, erc-show-my-nick, erc-prompt,
176 erc-input-line-position, erc-command-indicator, erc-notice-prefix,
177 erc-notice-highlight-type, erc-interpret-controls-p,
178 erc-interpret-mirc-color, erc-minibuffer-notice,
179 erc-format-nick-function): Use 'erc-display as `:group'.
180 (erc-mode-line-format, erc-header-line-format,
181 erc-header-line-uses-help-echo-p, erc-common-server-suffixes,
182 erc-mode-line-away-status-format): Use 'erc-mode-line-and-header
183 as `:group'.
184 (erc-hide-list, erc-ignore-list, erc-ignore-reply-list,
185 erc-minibuffer-ignored): Use 'erc-ignore as `:group'.
186 (erc-auto-query, erc-query-on-unjoined-chan-privmsg,
187 erc-format-query-as-channel-p): Use 'erc-query as `:group'.
188 (erc-kill-buffer-on-part, erc-kill-queries-on-quit,
189 erc-kill-server-buffer-on-quit, erc-quit-reason-various-alist,
190 erc-part-reason-various-alist, erc-quit-reason, erc-part-reason):
191 Use 'erc-quit-and-part as `:group'.
192 (erc-verbose-server-ping, erc-paranoid, erc-disable-ctcp-replies,
193 erc-anonymous-login, erc-show-channel-key-p): Use 'erc-paranoia as
194 `:group'.
195 (erc-startup-file-list, erc-script-path, erc-script-echo): Use
196 'erc-scripts as `:group'.
197 (erc-nick-completion, erc-nick-completion-ignore-case,
198 erc-nick-completion-postfix): Use 'erc-old-complete as `:group'.
199 (erc-chanlist-progress-message, erc-no-list-networks,
200 erc-chanlist-frame-parameters, erc-chanlist-hide-modeline,
201 erc-chanlist-mode-hook): Use 'erc-list as `:group'.
202 (erc-server-alist, erc-networks-alist): Use 'erc-networks as
203 `:group'.
204 (erc-settings): Use `defvar' instead of `defcustom' since this is
205 only a draft which doesn't work.
206 (erc-nicklist-window-size): Use 'erc-nicklist as `:group'.
207 (erc-pcomplete-nick-postfix,
208 erc-pcomplete-order-nickname-completions): Use 'erc-pcomplete as
209 `:group'.
210 (erc-replace-alist): Use 'erc-replace as `:group'.
211 (erc-speak-filter-timestamp): Use 'erc-speak as `:group'.
212 (erc-max-buffer-size): Use 'erc-truncate as `:group'.
213
2142004-12-12 Jorgen Schaefer <forcer@users.sourceforge.net>
215
216 * erc.el (erc-scroll-to-bottom): Go to the end of the buffer
217 before recentering. This allows editing multiple lines more
218 conveniently in CVS Emacs. This also undos a change by antifuchs
219 who said this goto-char would mess up redisplay. Extensive testing
220 couldn't reproduce that problem.
221
2222004-12-12 Brian Palmer <bpalmer@gmail.com>
223
224 * erc.el (erc-send-ctcp-message): upcase the ctcp message (so that
225 version becomes VERSION, for example).
226 (erc-iswitchb): Make the argument optional in non-interactive
227 invocation, so erc-iswitchb can be substituted directly for
228 iswitchb in code.
229
2302004-12-11 Diane Murray <disumu@x3y2z1.net>
231
232 * erc-track.el (erc-track-position-in-mode-line): Allow for the
233 fact that `erc-track-mode' isn't bound when file is loaded.
234
2352004-12-11 Diane Murray <disumu@x3y2z1.net>
236
237 * erc-track.el (erc-track-position-in-mode-line): New customizable
238 variable. (erc-track-remove-from-mode-line): New function.
239 Remove `erc-modified-channels-string' from the mode-line.
240 (erc-track-add-to-mode-line): New function. Add
241 `erc-modified-channels-string' to the mode-line using the value of
242 `erc-track-position-in-mode-line' to determine whether to add it
243 to the beginning or the end of `mode-line-modes' (only available
244 with GNU Emacs versions above 21.3) or to the end of
245 `global-mode-string'.
246 (erc-track-mode, erc-track-when-inactive-mode): Use the new
247 functions.
248
2492004-12-11 Jorgen Schaefer <forcer@users.sourceforge.net>
250
251 * erc.el: (erc-cmd-BANLIST): Use (buffer-name) and not
252 (erc-default-target) for the buffer name - buffer names are case
253 sensitive.
254
2552004-12-11 Brian Palmer <bpalmer@gmail.com>
256
257 * erc.el (erc-message-type): Added the message "MODE" to the known
258 erc-message-type widget, so that (for example) people can tell
259 erc-track-exclude-types to ignore mode changes. The others tag
260 also needed to be made an inline list, so that it's merged with
261 the given constants, instead of being inserted as a list.
262
2632004-12-10 Jorgen Schaefer <forcer@users.sourceforge.net>
264
265 * erc-track.el, erc.el: Update to get ERC look nicely in CVS Emacs.
266
267 * erc.el (erc-mode-line-format): When on CVS emacs, use the new
268 format.
269
270 * erc-track.el (track module): When on CVS emacs, modify
271 mode-line-modes instead of global-mode-string. The latter is way
272 to far too the right.
273
2742004-11-18 Mario Lang <mlang@delysid.org>
275
276 * Makefile, debian/changelog: debian release 20041118-1
277
2782004-11-03 Diane Murray <disumu@x3y2z1.net>
279
280 * erc-button.el (erc-button-buttonize-nicks): Set default value to
281 `t'. Updated documentation and customization `:type' to reflect
282 usage.
283
2842004-10-29 Johan Bockgard <bojohan@users.sourceforge.net>
285
286 * AUTHORS: Added self.
287
2882004-10-17 Diane Murray <disumu@x3y2z1.net>
289
290 * erc-list.el: Added local variables for this file.
291 (erc-list-version): New.
292 (erc-cmd-LIST): Take &rest rather than &optional arguments, as was
293 done in revision 1.21. Allow for input when called interactively.
294 (erc-prettify-channel-list, erc-chanlist-toggle-sort-state): Use
295 `unless' instead of when not.
296
2972004-10-17 Diane Murray <disumu@x3y2z1.net>
298
299 * erc-backend.el (erc-handle-unknown-server-response): Fixed so
300 that the contents are only shown once. (MOTD): Display lines in
301 the server buffer if it's the first MOTD sent upon connection.
302 This is to avoid the problem of having the MOTD of one server
303 showing up in another server's buffer if it took a while to get
304 connected.
305 (004): Fixed to show the user modes and channel modes correctly.
306 (303): Now displays the nicknames returned by ISON instead of the
307 user's nickname.
308 (367, 368): Moved up into 300's section of the code. Added
309 documentation. Use `multiple-value-bind' to set variables in 367.
310 (391): Fixed so that the server name is shown correctly.
311
3122004-10-17 Diane Murray <disumu@x3y2z1.net>
313
314 * erc.el (erc-process-sentinel): Use CPROC instead of
315 `erc-process' in debug message. Should fix a bug where an error
316 saying "Buffer *scratch* has no process" would occur when
317 disconnected.
318 (erc-cmd-SV): Check for X toolkit after checking for more specific
319 features. (erc--kill-server): Set `quitting' to non-nil so that
320 we don't automatically reconnect.
321
3222004-10-05 Jorgen Schaefer <forcer@users.sourceforge.net>
323
324 * erc.el: (erc-ignored-user-p): Don't require regexes to match the
325 beginning.
326
3272004-09-11 Jorgen Schaefer <forcer@users.sourceforge.net>
328
329 * erc.el: group erc: Moved to 'applications (patch by bojohan)
330
3312004-09-08 Jorgen Schaefer <forcer@users.sourceforge.net>
332
333 * erc-button.el: (erc-button-remove-old-buttons): Remove 'keymap
334 not 'local-map.
335
3362004-09-03 Jorgen Schaefer <forcer@users.sourceforge.net>
337
338 * erc-backend.el: JOIN response handler: Typo fix of the last
339 commit.
340
3412004-09-03 Jorgen Schaefer <forcer@users.sourceforge.net>
342
343 * erc-backend.el: JOIN response handler: Run `erc-join-hook'
344 without arguments as specified in the docstring.
345
3462004-08-27 Jorgen Schaefer <forcer@users.sourceforge.net>
347
348 * erc.el (erc-send-current-line): Removed unused variable SENTP.
349
3502004-08-19 Jorgen Schaefer <forcer@users.sourceforge.net>
351
352 * erc.el: ERC-SEND-COMPLETED-HOOK used to be run when the prompt
353 was already displayed. We restore this behavior (thanks to bojohan
354 and TerryP for noticing). We also fix the docstring of
355 ERC-SEND-COMPLETED-HOOK, since the hook is (and used to be) called
356 even if nothing was sent to the server.
357 (erc-send-completed-hook): Fixed docstring.
358 (erc-send-current-line): Add incantation for
359 erc-send-completed-hook.
360 (erc-send-input): Remove incantation for erc-send-completed-hook.
361
3622004-08-18 Jorgen Schaefer <forcer@users.sourceforge.net>
363
364 * erc-backend.el: response-handler 368: Use s368, not s367.
365
3662004-08-17 Jorgen Schaefer <forcer@users.sourceforge.net>
367
368 * erc.el (erc-scroll-to-bottom): Don't scroll when we're not
369 connected anymore.
370
3712004-08-17 Jorgen Schaefer <forcer@users.sourceforge.net>
372
373 * erc-backend.el, erc.el: Handle /mode #emacs b output without
374 errors and such. First, handle unknown format specs gracefully
375 (that is, give a useful error). Then, provide handlers for the
376 banlist replies.
377
378 * erc-backend.el: New handler for 367 and 368. Removed from default
379 handler.
380
381 * erc.el: Provide english catalog for s367 and s368.
382 (erc-format-message): Give an error message when we don't find an
383 entry.
384
3852004-08-17 Jorgen Schaefer <forcer@users.sourceforge.net>
386
387 * erc-fill.el: erc-fill-variable could be confused about really
388 long nicks. We put an upper limit on the length of the fill prefix.
389 (erc-fill-variable): Adjust fill-prefix.
390 erc-fill-variable-maximum-indentation: New variable.
391
3922004-08-17 Francis Litterio <franl@users.sourceforge.net>
393
394 * erc.el (erc-send-input): Fixed a bug where this function
395 referenced variable "input" instead of variable "str".
396
3972004-08-16 Francis Litterio <franl@users.sourceforge.net>
398
399 * erc-list.el (erc-chanlist-highlight-line): Fixed a bug where
400 this function failed to set the correct face for highlighting the
401 current line.
402
4032004-08-14 Jorgen Schaefer <forcer@users.sourceforge.net>
404
405 * erc-fill.el (erc-fill-variable): Don't fuck up when the
406 looking-at didn't work.
407
4082004-08-14 Jorgen Schaefer <forcer@users.sourceforge.net>
409
410 * erc.el (erc-send-single-line): Call the hooks to change the
411 appearance for something only if we actually inserted something,
412 doh.
413 (erc-display-command): Display the prompt outside of the area that
414 set the text properties on.
415
4162004-08-14 Jorgen Schaefer <forcer@users.sourceforge.net>
417
418 * erc.el: Refactored erc-send-current-line. This should fix some
419 dormant bugs, and make the whole thing actually readable. Yay.
420 Some changes in behavior were made. Whitespace at the end of lines
421 sent is not removed anymore, but that shouldn't bother anyone.
422 Additionally, errors in commands or hooks shouldn't prevent the
423 prompt from showing up again now.
424 (erc-parse-current-line): Removed.
425 (erc-send-current-line): Refactored.
426 (erc-send-input): New function.
427 (erc-send-single-line): New function.
428 (erc-display-command): New function.
429 (erc-display-msg): New function.
430 (erc-user-input): New function.
431
4322004-08-13 Jorgen Schaefer <forcer@users.sourceforge.net>
433
434 * erc.el (erc-cmd-SERVER): Use newer keyword call interface to
435 erc-select, and handle the error if it can't resolve the host.
436
4372004-08-11 Jorgen Schaefer <forcer@users.sourceforge.net>
438
439 * erc-backend.el, erc.el: erc-backend.el (404 response handler):
440 New function. We now support "cannot send to channel".
441
442 * erc.el (erc-define-catalog call): Added s404. erc.el
443 (erc-ctcp-ECHO-reply, erc-ctcp-CLIENTINFO-reply,
444 erc-ctcp-FINGER-reply, erc-ctcp-PING-reply, erc-ctcp-TIME-reply,
445 erc-ctcp-VERSION-reply): Display reply in the active window, not
446 the server window.
447
4482004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
449
450 * erc.el (erc-with-all-buffers-of-server): Actually make it left
451 to right, doh.
452
4532004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
454
455 * erc.el (erc-with-all-buffers-of-server): Evaluate left-to-right
456 so we don't surprise a user.
457
4582004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
459
460 * erc.el (erc-process-input-line): Parentophobia! Another
461 paren-fix.
462
4632004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
464
465 * erc-backend.el: PRIVMSG NOTICE response handler: Killed one paren
466 too much. Poor paren. Got resurrected.
467
4682004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
469
470 * erc-track.el: Make server buffers showing up in the mode line
471 optional. Thanks to Daniel Knapp on the EmacsWiki for this patch.
472
473 erc-track-exclude-server-buffer: New variable.
474 (erc-track-modified-channels): Return a server buffer only if
475 erc-track-exclude-server-buffer is nil.
476
4772004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
478
479 * erc.el: (erc-cmd-DESCRIBE): Don't parse arguments.
480
4812004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
482
483 * erc-truncate.el: (erc-truncate-buffer-to-size): Use
484 erc-insert-marker, not (point-max), to decide the length of the
485 buffer. A long input line shouldn't make the buffer smaller.
486
4872004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
488
489 * erc-macs.el, erc-members.el: The change to hashes for channel
490 members has been made some time ago. Clean up the various tries to
491 do this in the past.
492
493 erc-macs.el: Removed. erc-members.el: Removed.
494
4952004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
496
497 * erc-backend.el, erc-ibuffer.el, erc-members.el, erc.el: Nothing
498 big changed here. Really. Uhm, maybe the info-buffers are gone or
499 so. Can't really remember. Don't worry, nothing important is
500 missing.
501
502 erc-speedbar.el looks nice btw, did you know?
503
504 Adjusted various places in erc.el, erc-backend.el, erc-ibuffer.el
505 and erc-members.el - too numerous to list here, sorry.
506
507 * erc.el: erc-use-info-buffers: Removed. erc-info-mode-map:
508 Removed.
509 (erc-info-mode): Removed.
510 (erc-find-channel-info-buffer): Removed.
511 (erc-update-channel-info-buffer): Removed.
512 (erc-update-channel-info-buffers): Removed.
513
514 * erc-members.el: erc-update-member renamed to
515 erc-update-channel-member for better clarity.
516
5172004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
518
519 * erc.el: This change improves the help output on a bogus command
520 invocation. We display the command as it would be typed by the
521 user, not as it is seen by Emacs.
522
523 (erc-get-arglist): Is now called erc-function-arglist, and returns
524 now an arglist without the enclosing parens.
525 (erc-command-name): New function.
526 (erc-process-input-line): Pass the command name, not the function
527 name.
528
5292004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
530
531 * erc.el: (erc-process-input-line): Fix bug when the command
532 doesn't have an arglist or no documentation. Thanks bojohan again
533 :)
534
5352004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
536
537 * erc-match.el: (erc-add-entry-to-list),
538 (erc-remove-entry-from-list): Update docstring, a TEST argument is
539 not given.
540
5412004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
542
543 * erc.el (erc-with-buffer): Really fix this docstring.
544
5452004-08-10 Jorgen Schaefer <forcer@users.sourceforge.net>
546
547 * erc.el (erc-with-buffer): Fix double evaluation in macro, and
548 fix docstring.
549
5502004-08-10 Brian Palmer <bpalmer@gmail.com>
551
552 * erc.el (erc-cmd-JOIN): Use erc-member-ignore-case instead of
553 member-ignore-case.
554
5552004-08-09 Johan Bockgard <bojohan@users.sourceforge.net>
556
557 * erc-backend.el: Define an "Edebug specification" for the
558 `define-erc-response-handler' macro. This means that one can step
559 through response handlers defined by this macro with edebug. Maybe
560 more macros would benefit from this?
561
5622004-08-09 Johan Bockgard <bojohan@users.sourceforge.net>
563
564 * erc-pcomplete.el (pcomplete/erc-mode/CTCP): New function.
565 Completion for the /CTCP command. (erc-pcomplete-ctcp-commands):
566 New variable. List of ctcp commands.
567
5682004-08-09 Johan Bockgard <bojohan@users.sourceforge.net>
569
570 * erc-list.el: Clean up docstrings.
571 (erc-prettify-channel-list): Extend properties to cover the entire
572 line, including the newline, to make it look
573 better.
574 (erc-chanlist-highlight-line): Ditto.
575 (erc-chanlist-mode-hook): Make it a defcustom.
576
5772004-08-09 Jorgen Schaefer <forcer@users.sourceforge.net>
578
579 * erc.el (erc-compute-full-name): Typo fix, should be full-name,
580 not name.
581
5822004-08-09 Jorgen Schaefer <forcer@users.sourceforge.net>
583
584 * erc.el (erc): Setup the buffer to be shown in a window at the
585 end of this function. This enables 'window-noselect to work
586 properly.
587 (erc, erc-send-current-line): Fix some
588 goto-char/open-line/goto-char to goto-char/insert.
589
5902004-08-08 Jorgen Schaefer <forcer@users.sourceforge.net>
591
592 * erc.el (erc-parse-user): Live with bogus info from bouncers.
593
5942004-07-31 Brian Palmer <bpalmer@gmail.com>
595
596 * erc.el (erc-select): Change the docstring to reflect the new
597 arguments; include the arguments in the docstring for non-cvs
598 emacs. Change the parameters to call erc-compute-* instead of
599 using the erc-* variables directly.
600 (erc-compute-server): Made argument optional.
601 (erc-compute-nick): ditto.
602 (erc-compute-full-name): ditto. (erc-compute-port): ditto.
603
6042004-07-30 Francis Litterio <franl@users.sourceforge.net>
605
606 * erc.el: (erc-cmd-BANLIST): Fixed a bug where channel-banlist was
607 not reset to nil before fetching an updated banlist from the
608 server.
609
6102004-07-30 Francis Litterio <franl@users.sourceforge.net>
611
612 * erc.el: (erc-cmd-BANLIST): Fixed a bug where the
613 'received-from-server property on variable channel-banlist was not
614 being reset to nil. This fixes the symptom where one types
615 /BANLIST and sees "No bans for channel: #whatever" when you know
616 there are bans.
617
6182004-07-23 Brian Palmer <bpalmer@gmail.com>
619
620 * erc.el: (erc-select-read-args): Use erc-compute-nick to
621 calculate the default nickname
622
6232004-07-20 Brian Palmer <bpalmer@gmail.com>
624
625 * erc.el: (erc-process-sentinel-1): New function. This is an
626 auxiliary function refactored out of erc-process-sentinel to
627 decide a server buffer's fate (whether it should be killed, and
628 whether erc should attempt to auto-reconnect). Michael Olson
629 <mwolson@gnu.org> helped with this.
630 (erc-kill-server-buffer-on-quit): New variable. Used in
631 erc-process-sentinel-1 to decide whether to kill a server buffer
632 when the user quit normally.
633 (erc-process-sentinel): Auxiliary function erc-process-sentinel-1
634 split out. The function body has `with-current-buffer' wrapped
635 around it, to ensure separation of messages if multiple
636 connections were being made. Use `if' instead of `cond' in places
637 where the decision is binary. The last (useless, since the server
638 connection is closed) prompt in the server buffer is removed.
639 Color "erc terminated" and "erc finished" messages with
640 erc-error-face. Mark the buffer unmodified so that, if not killed
641 automatically, the user is not prompted to save it.
642
6432004-07-16 Brian Palmer <bpalmer@gmail.com>
644
645 * erc.el (erc-select-read-args): New function. Prompts the user
646 for arguments to pass to erc-select and erc-select-ssl.
647 (erc-select): Use (erc-select-read-args) when called interactively
648 to get its arguments. When non-interactively, use keyword
649 arguments.
650 (erc-select-ssl): Ditto.
651 (erc-compute-port): New function. Parallel to erc-compute-server,
652 but comes up with a default value for an IRC server's port.
653
6542004-07-16 Jorgen Schaefer <forcer@users.sourceforge.net>
655
656 * erc-match.el (erc-match-message): Quote the current nickname.
657
6582004-07-12 Brian Palmer <bpalmer@gmail.com>
659
660 * erc-list.el (erc-chanlist-mode): Remove explicit invocation of
661 erc-chanlist-mode-hook, since it's automatically invoked by
662 define-derived-mode
663
6642004-07-03 Jorgen Schaefer <forcer@users.sourceforge.net>
665
666 * erc-match.el (erc-match-current-nick-p): Quote current nick for
667 regexp parsing.
668
6692004-06-27 Johan Bockgard <bojohan@users.sourceforge.net>
670
671 * erc-nickserv.el (erc-nickserv-identify-mode): Fix erroneous
672 parentheses in call to `completing-read'.
673
6742004-06-23 Alex Schroeder <alex@gnu.org>
675
676 * Makefile (release): Depend on autoloads, and copy erc-auto.el
677 into the tarball.
678
6792004-06-14 Francis Litterio <franl@users.sourceforge.net>
680
681 * erc.el (erc-log-irc-protocol): Fixed minor bug where each line
682 received from a server was logged as two lines (one with text and
683 one blank).
684
6852004-06-08 Brian Palmer <bpalmer@gmail.com>
686
687 * erc-list.el (erc-chanlist-frame-parameters): Made customizable.
688 (erc-chanlist-header-face): Changed to use defface with some
689 reasonable defaults instead of make-face, and removed the
690 associated -face variable.
691 (erc-chanlist-odd-line-face): Ditto.
692 (erc-chanlist-even-line-face): Ditto.
693 (erc-chanlist-highlight-face): New variable. Holds a face used for
694 highlighting the current line.
695 (erc-cmd-LIST): Use erc-member-ignore-case instead of
696 member-ignore-case.
697 (erc-chanlist-post-command-hook): Change to move the highlight
698 overlay instead of refontifying the entire buffer.
699 (erc-chanlist-dehighlight-line): Added to detach the highlight
700 overlay from the buffer.
701
7022004-05-31 Jorgen Schaefer <forcer@users.sourceforge.net>
703
704 * erc.el: erc-mode-line-format: Add column numbers.
705
7062004-05-31 Adrian Aichner <adrian@xemacs.org>
707
708 * erc-autojoin.el: Typo fix.
709
710 * erc-dcc.el (erc-dcc-do-GET-command): Use expand-file-name.
711 (erc-dcc-get-file): XEmacs set-buffer-multibyte compatibility.
712
713 * erc-log.el: Append `erc-log-setup-logging' to
714 `erc-connect-pre-hook' so that `erc-initialize-log-marker' is run
715 first (markers are needed by `erc-log-setup-logging').
716 (erc-enable-logging): Docstring fix.
717 (erc-log-setup-logging): Move `erc-log-insert-log-on-open' to (1-
718 (point-max)) when doing `erc-log-insert-log-on-open'. Modified
719 version of a patch by Lawrence Mitchell.
720 (erc-log-all-but-server-buffers): Do `save-excursion' as well.
721 (erc-current-logfile): Pass buffer name as target
722 argument to `erc-generate-log-file-name-function' if
723 `erc-default-target' is nil.
724 (erc-generate-log-file-name-with-date): Use expand-file-name.
725 (erc-generate-log-file-name-short): Ditto.
726 (erc-save-buffer-in-logs): Do `save-excursion' and test whether
727 erc-last-saved-position is a marker.
728
729 * erc-members.el: Avoid miscompiling macro `erc-log' and
730 `with-erc-channel-buffer' by requiring 'erc at compile time.
731
732 * erc-sound.el: Use expand-file-name.
733
734 * erc.el (erc-debug-log-file): Ditto.
735 (erc-find-file): Ditto.
736
7372004-05-26 Francis Litterio <franl@users.sourceforge.net>
738
739 * erc.el, erc-backend.el (erc-cmd-BANLIST): Added a missing "'"
740 that was preventing /BANLIST from working. In erc-backend.el,
741 added server repsonse handler for 367 and 368 reponses to get
742 /BANLIST working.
743
7442004-05-26 Francis Litterio <franl@users.sourceforge.net>
745
746 * erc.el: Removed an eval-when-compile that was preventing the
747 byte-compiled version of this file from loading.
748
7492004-05-26 Francis Litterio <franl@users.sourceforge.net>
750
751 * erc.el: Undid part of my last change. I suspect it was wrong.
752
7532004-05-26 Francis Litterio <franl@users.sourceforge.net>
754
755 * erc.el: Silenced several byte-compiler warnings.
756
7572004-05-26 Francis Litterio <franl@users.sourceforge.net>
758
759 * erc.el (erc-log-irc-protocol): Fixed problem where this function
760 misformatted IRC protocol text if multiple lines were received from
761 the server at one time.
762
7632004-05-25 Francis Litterio <franl@users.sourceforge.net>
764
765 * erc.el (erc-toggle-debug-irc-protocol): Cosmetic changes to the
766 informational text in the *erc-protocol* buffer.
767
7682004-05-24 Francis Litterio <franl@users.sourceforge.net>
769
770 * erc.el (erc-log-irc-protocol, erc-process-filter): Now the lines
771 inserted in the *erc-protocol* buffer are prefixed with the name
772 of the network to/from which the data is going/coming. This makes
773 reading the *erc-protocol* buffer much easier when connected to
774 multiple networks.
775
7762004-05-23 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
777
778 * erc-backend.el: Fixes server message parsing so that command
779 arguments specified after the colon are not treated specially. All
780 arguments are added to the `command-args' field, and the
781 `contents' points to the last element in the `command-args' list.
782 This allows ERC to connect to networks such as Undernet. Although
783 keeping `contents' allows many of the response handlers to
784 continue to work as-is, many other are probably broken by this
785 patch.
786
7872004-05-20 Lawrence Mitchell <wence@gmx.li>
788
789 * HACKING: Add comment that C-c C-a can be useful if you write
790 ChangeLog entries using Emacs' standard functions.
791
7922004-05-17 Diane Murray <disumu@x3y2z1.net>
793
794 * erc-speedbar.el: Ignore errors when attempting to require dframe
795 (there are a couple implementations of speedbar, one of which uses
796 of dframe).
797 (erc-speedbar-version): New.
798 (erc-speedbar-goto-buffer): Use dframe functions if dframe is
799 available.
800
8012004-05-17 Diane Murray <disumu@x3y2z1.net>
802
803 * erc-autojoin.el: Added local variables for this file.
804 (erc-autojoin-add): The channel name is in `erc-response.contents'.
805
8062004-05-17 Mario Lang <mlang@delysid.org>
807
808 * erc-log.el: Dont autoload a define-key statement, erc-mode-map
809 might not be known yet
810
8112004-05-16 Lawrence Mitchell <wence@gmx.li>
812
813 * erc-backend.el (erc-parse-server-response): Revert to original
814 `erc-parse-line-from-server' version, since new version breaks for
815 a number of edge cases.
816
8172004-05-14 Diane Murray <disumu@x3y2z1.net>
818
819 * erc-backend.el (erc-handle-unknown-server-response): New
820 function. Added to `erc-default-server-functions'. Display
821 unknown responses to the user.
822 (221): Don't show nickname in modes list.
823 (254): Fixed to use 's254.
824 (303): Added docstring.
825 (315, 318, 323, 369): Ignored responses grouped together.
826 (391): New.
827 (406, 432): Use ?n, not ?c in `erc-display-message'.
828 (431, 445, 446, 451, 462, 463, 464, 465, 481, 483, 485, 491, 501,
829 502): All error responsess with no arguments grouped together.
830
8312004-05-14 Diane Murray <disumu@x3y2z1.net>
832
833 * erc.el (erc-message-type-member): Use `erc-response.command'.
834 `erc-track-exclude-types' should be respected again.
835 (erc-cmd-TIME): Fixed to work with and without server given as
836 argument.
837 (erc-define-catalog): Added, s391, s431, s445, s446, s451, s462,
838 s463, s464, s465, s483, s484, s485, s491, s501, s502.
839
8402004-05-14 Lawrence Mitchell <wence@gmx.li>
841
842 * HACKING: Typo fix.
843
8442004-05-14 Lawrence Mitchell <wence@gmx.li>
845
846 * Makefile (erc-auto.el): Pass -f flag to rm so that we don't fail
847 if erc-auto.elc doesn't exist.
848
8492004-05-14 Lawrence Mitchell <wence@gmx.li>
850
851 * erc-backend.el (erc-with-buffer): Autoload.
852 (erc-parse-server-response): XEmacs' `replace-match' only replaces
853 subexpressions when operating on buffers, not strings, work around
854 it.
855 (461): Command with invalid arguments is `second', not `third'.
856
8572004-05-14 Diane Murray <disumu@x3y2z1.net>
858
859 * erc-notify.el (erc-notify-NICK): Use `erc-response.contents' to
860 get nickname.
861
8622004-05-13 Lawrence Mitchell <wence@gmx.li>
863
864 * erc-track.el: Indentation fixes.
865 (track-when-inactive): Use `erc-server-FOO-functions', not
866 `erc-server-FOO-hook.
867
8682004-05-13 Lawrence Mitchell <wence@gmx.li>
869
870 * erc-notify.el (notify): Use `erc-server-FOO-functions', not
871 `erc-server-FOO-hook.
872 (erc-notify-timer, erc-notify-JOIN, erc-notify-NICK)
873 (erc-notify-QUIT): Use new accessors for PARSED argument.
874
8752004-05-13 Lawrence Mitchell <wence@gmx.li>
876
877 * erc-nickserv.el (services, erc-nickserv-identify-mode): Use
878 `erc-server-FOO-functions', not `erc-server-FOO-hook.
879 (erc-nickserv-identify-autodetect): Use new accessors for PARSED
880 argument.
881
8822004-05-13 Lawrence Mitchell <wence@gmx.li>
883
884 * erc-netsplit.el (netsplit): Use `erc-server-FOO-functions', not
885 `erc-server-FOO-hook.
886 (erc-netsplit-JOIN, erc-netsplit-MODE, erc-netsplit-QUIT): Use new
887 accessors for PARSED argument.
888
8892004-05-13 Lawrence Mitchell <wence@gmx.li>
890
891 * erc-nets.el: Use `erc-server-FOO-functions', not
892 `erc-server-FOO-hook.
893
8942004-05-13 Lawrence Mitchell <wence@gmx.li>
895
896 * erc-menu.el (erc-menu-definition): Only allow listing of
897 channels if `erc-cmd-LIST' is fboundp.
898
8992004-05-13 Lawrence Mitchell <wence@gmx.li>
900
901 * erc-match.el: Use `erc-server-FOO-functions', not
902 `erc-server-FOO-hook.
903 (erc-get-parsed-vector-nick, erc-get-parsed-vector-type): Use new
904 accessors for PARSED argument.
905
9062004-05-13 Lawrence Mitchell <wence@gmx.li>
907
908 * erc-list.el (erc-chanlist, erc-chanlist-322): Use new accessors
909 for PARSED argument. Use `erc-server-FOO-functions', not
910 `erc-server-FOO-hook.
911
9122004-05-13 Lawrence Mitchell <wence@gmx.li>
913
914 * erc-ezbounce.el (erc-ezb-notice-autodetect): Use new accessors
915 for PARSED argument.
916 (erc-ezb-initialize): Use `erc-server-FOO-functions', not
917 `erc-server-FOO-hook.
918
9192004-05-13 Lawrence Mitchell <wence@gmx.li>
920
921 * erc-dcc.el: Use `erc-server-FOO-functions', not
922 `erc-server-FOO-hook.
923 (erc-dcc-no-such-nick): Use new accessors for PARSED argument.
924
9252004-05-13 Lawrence Mitchell <wence@gmx.li>
926
927 * erc-bbdb.el (erc-bbdb-whois, erc-bbdb-JOIN, erc-bbdb-NICK): Use
928 new accessors for PARSED argument.
929 (BBDB): Use `erc-server-FOO-functions', not `erc-server-FOO-hook.
930
9312004-05-13 Lawrence Mitchell <wence@gmx.li>
932
933 * erc-autojoin.el (autojoin): Use `erc-server-FOO-functions', not
934 `erc-server-FOO-hook.
935 (erc-autojoin-add, erc-autojoin-remove): Use new accessors for
936 PARSED argument.
937
9382004-05-13 Lawrence Mitchell <wence@gmx.li>
939
940 * erc-autoaway.el (autoaway): Use `erc-server-FOO-functions', not
941 `erc-server-FOO-hook.
942
9432004-05-13 Lawrence Mitchell <wence@gmx.li>
944
945 * erc.el (erc-backend): Require.
946 (erc-disconnected-hook, erc-join-hook, erc-quit-hook)
947 (erc-part-hook, erc-kick-hook): Docstring fix, we now use
948 `erc-server-FOO-functions', rather than `erc-server-FOO-hook'.
949 (erc-event-to-hook-name, erc-event-to-hook): Remove.
950 (erc-once-with-server-event)
951 (erc-once-with-server-event-global): Use `erc-get-hook'
952 (erc-process-filter): Use `erc-parse-server-response'.
953 (erc-cmd-IDLE, erc-cmd-BANLIST, erc-cmd-MASSUNBAN): New accessors
954 for PARSED argument. Rename all `erc-server-FOO-hook' to
955 `erc-server-FOO-functions'.
956 (erc-server-364-hook, erc-server-365-hook, erc-server-367-hook)
957 (erc-server-368-hook, erc-server-KILL-hook)
958 (erc-server-PONG-hook, erc-server-200-hook, erc-server-201-hook)
959 (erc-server-202-hook, erc-server-203-hook, erc-server-204-hook)
960 (erc-server-205-hook, erc-server-206-hook, erc-server-208-hook)
961 (erc-server-209-hook, erc-server-211-hook, erc-server-212-hook)
962 (erc-server-213-hook, erc-server-214-hook, erc-server-215-hook)
963 (erc-server-216-hook, erc-server-217-hook, erc-server-218-hook)
964 (erc-server-219-hook, erc-server-241-hook, erc-server-242-hook)
965 (erc-server-243-hook, erc-server-244-hook, erc-server-249-hook)
966 (erc-server-261-hook, erc-server-262-hook, erc-server-302-hook)
967 (erc-server-323-hook, erc-server-342-hook, erc-server-351-hook)
968 (erc-server-381-hook, erc-server-382-hook, erc-server-391-hook)
969 (erc-server-392-hook, erc-server-393-hook, erc-server-394-hook)
970 (erc-server-395-hook, erc-server-402-hook, erc-server-404-hook)
971 (erc-server-407-hook, erc-server-409-hook, erc-server-411-hook)
972 (erc-server-413-hook, erc-server-414-hook, erc-server-415-hook)
973 (erc-server-422-hook, erc-server-423-hook, erc-server-424-hook)
974 (erc-server-431-hook, erc-server-436-hook, erc-server-437-hook)
975 (erc-server-441-hook, erc-server-443-hook, erc-server-444-hook)
976 (erc-server-445-hook, erc-server-446-hook, erc-server-451-hook)
977 (erc-server-462-hook, erc-server-463-hook, erc-server-464-hook)
978 (erc-server-465-hook, erc-server-467-hook, erc-server-471-hook)
979 (erc-server-472-hook, erc-server-473-hook, erc-server-483-hook)
980 (erc-server-491-hook, erc-server-502-hook): Remove.
981 (erc-call-hooks, erc-parse-line-from-server): Remove
982 (erc-server-hook-list): Remove. Remove top-level call too.
983 (erc-server-ERROR, erc-server-INVITE, erc-server-JOIN)
984 (erc-server-KICK, erc-server-MODE, erc-server-NICK)
985 (erc-server-PART, erc-server-PING, erc-server-PONG)
986 (erc-server-PRIVMSG-or-NOTICE, erc-server-QUIT)
987 (erc-server-TOPIC, erc-server-WALLOPS, erc-server-001)
988 (erc-server-004, erc-server-005, erc-server-221, erc-server-252)
989 (erc-server-253, erc-server-254, erc-server-301, erc-server-303)
990 (erc-server-305, erc-server-306, erc-server-311-or-314)
991 (erc-server-312, erc-server-313, erc-server-317, erc-server-319)
992 (erc-server-320, erc-server-321, erc-server-322, erc-server-324)
993 (erc-server-329, erc-server-330, erc-server-331, erc-server-332)
994 (erc-server-333, erc-server-341, erc-server-352, erc-server-353)
995 (erc-server-366, erc-server-MOTD, erc-server-379)
996 (erc-server-401, erc-server-403, erc-server-405, erc-server-406)
997 (erc-server-412, erc-server-421, erc-server-432, erc-server-433)
998 (erc-server-437, erc-server-442, erc-server-461, erc-server-474)
999 (erc-server-475, erc-server-477, erc-server-481, erc-server-482)
1000 (erc-server-501): Move to erc-backend.el
1001 (erc-auto-query, erc-banlist-store, erc-banlist-finished)
1002 (erc-banlist-update, erc-connection-established)
1003 (erc-process-ctcp-query, erc-display-server-message): Use new
1004 accessors for PARSED argument.
1005
10062004-05-13 Lawrence Mitchell <wence@gmx.li>
1007
1008 * erc-backend.el: (erc-parse-server-response)
1009 (erc-handle-parsed-server-response, erc-get-hook)
1010 (define-erc-response-handler): New functions.
1011 (erc-response): New struct for server responses.
1012 (erc-server-responses): New variable.
1013 (erc-call-hooks): Move from erc.el and rework.
1014 (ERROR, INVITE, JOIN, KICK, MODE, NICK, PART, PING, PONG)
1015 (PRIVMSG, NOTICE, QUIT, TOPIC, WALLOPS, 001, MOTD, 376, 004)
1016 (252, 253, 254, 250, 301, 303, 305, 306, 311, 312, 313, 315)
1017 (317, 318, 319, 320, 321, 322, 324, 329, 330, 331, 332, 333)
1018 (341, 352, 353, 366, 369, 379, 401, 403, 405, 406, 412, 421)
1019 (432, 433, 437, 442, 461, 474, 477, 481, 482, 501, 323, 221)
1020 (002, 003, 371, 372, 374, 375, 422, 251, 255, 256, 257, 258)
1021 (259, 265, 266, 377, 378, 314, 475, 364, 365, 367, 368, 381)
1022 (382, 391, 392, 393, 394, 395, 200, 201, 202, 203, 204, 205)
1023 (206, 208, 209, 211, 212, 213, 214, 215, 216, 217, 218, 219)
1024 (241, 242, 243, 244, 249, 261, 262, 302, 342, 351, 402, 404)
1025 (407, 409, 411, 413, 414, 415, 423, 424, 431, 436, 441, 443)
1026 (444, 445, 446, 451, 462, 463, 464, 465, 467, 471, 472, 473)
1027 (483, 491, 502, 005, KILL): Move from erc.el and rework using
1028 `define-erc-response-handler' and erc-response struct.
1029
10302004-05-12 Diane Murray <disumu@x3y2z1.net>
1031
1032 * erc.el: A few bug fixes to avoid errors after disconnect,
1033 including the "Selecting deleted buffer" bug.
1034 (erc-channel-user-op-p, erc-channel-user-voice-p): Make sure NICK
1035 is non-nil (`erc-current-nick' can return nil).
1036 (erc-server-buffer): Make sure the buffer isn't a #<killed
1037 buffer>.
1038 (erc-server-buffer-live-p): New function.
1039 (erc-display-line, erc-join-channel, erc-prepare-mode-line-format,
1040 erc-away-p): Use `erc-server-buffer-live-p' to make sure process
1041 buffer exists.
1042 (erc-send-current-line): If there is no server buffer, let the
1043 user know.
1044
10452004-05-12 Diane Murray <disumu@x3y2z1.net>
1046
1047 * erc.el, erc-log.el: C-c C-l keybinding now defined in
1048 erc-log.el.
1049 (erc-log-version): New.
1050 (erc-cmd-JOIN): Fix applied for bug where /join -invite causes
1051 errors when there's no `invitation'.
1052
10532004-05-11 Diane Murray <disumu@x3y2z1.net>
1054
1055 * erc.el: (erc-cmd-JOIN): Make sure `chnl' is non-nil before trying
1056 to join anything (chnl is not set if /join -invite is used but
1057 there's no `invitation').
1058
10592004-05-10 Diane Murray <disumu@x3y2z1.net>
1060
1061 * erc-log.el: Define C-c C-l keybinding outside of `erc-log-mode',
1062 making it available all the time; autoload definition.
1063 (erc-log-version): New.
1064
10652004-05-09 Diane Murray <disumu@x3y2z1.net>
1066
1067 * AUTHORS, CREDITS, Makefile, erc-autoaway.el, erc-autojoin.el,
1068 erc-button.el, erc-chess.el, erc-dcc.el, erc-ezbounce.el,
1069 erc-fill.el, erc-ibuffer.el, erc-imenu.el, erc-lang.el,
1070 erc-list.el, erc-log.el, erc-macs.el, erc-match.el, erc-members.el,
1071 erc-menu.el, erc-nets.el, erc-netsplit.el, erc-nickserv.el,
1072 erc-notify.el, erc-page.el, erc-ring.el, erc-speak.el,
1073 erc-speedbar.el, erc-stamp.el, erc-track.el, erc-truncate.el,
1074 erc-xdcc.el, erc.el: Applied all relevant bug fixes and code
1075 cleanup made between the time of the ERC_4_0_RELEASE tag until now.
1076
10772004-05-09 Diane Murray <disumu@x3y2z1.net>
1078
1079 * erc-menu.el: Updated copyright years.
1080
10812004-05-09 Lawrence Mitchell <wence@gmx.li>
1082
1083 * erc.el (erc-update-channel-info-buffer): Correct bug in sorting
1084 of channel users. Tiny change from Andreas Schwab
1085 <schwab@suse.de>.
1086
10872004-05-09 Lawrence Mitchell <wence@gmx.li>
1088
1089 * erc-fill.el (erc-fill-variable): Fix docstring.
1090
10912004-05-09 Lawrence Mitchell <wence@gmx.li>
1092
1093 * erc-button.el (erc-button-add-button): Use 'keymap
1094 text-property, rather than 'local-map, since it's cross-emacs
1095 compatible. Pass :mouse-down-action into `widget-convert-button'
1096 as 'erc-button-click-button, to make XEmacs happy. Replace bogus
1097 reference to erc-widget-press-button with erc-button-press-button.
1098 (erc-button-click-button): New (ignored) first argument, to make
1099 XEmacs behave when pressing buttons.
1100 (erc-button-press-button): New (ignored) &rest argument.
1101
11022004-05-09 Adrian Aichner <adrian@xemacs.org>
1103
1104 * erc-log.el (erc-conditional-save-buffer): Fix docstring
1105 reference to erc-save-queries-on-quit.
1106 (erc-conditional-save-queries): Ditto.
1107
11082004-05-06 Diane Murray <disumu@x3y2z1.net>
1109
1110 * erc-speedbar.el: Updated copyright years. Added local variables
1111 for this file; fixed indenting.
1112 (erc-speedbar): New group.
1113 (erc-speedbar-sort-users-type): New variable.
1114 (erc-speedbar-buttons): Handle query buffers (fixes a bug where an
1115 error would be thrown if the current buffer was a query). Ignore
1116 unknown buffers.
1117 (erc-speedbar-expand-channel): Show limit and key with channel
1118 modes. Sort users according to `erc-speedbar-sort-users-type'.
1119 (erc-speedbar-insert-user): Fixed bug where only nicks with more
1120 info were being listed, and those were shown twice.
1121 (erc-speedbar-goto-buffer): Don't use dframe functions, as dframe
1122 isn't available with the default speedbar.
1123
11242004-05-06 Diane Murray <disumu@x3y2z1.net>
1125
1126 * erc.el: (erc-sort-channel-users-alphabetically): New function.
1127 (erc-server-412, erc-server-432, erc-server-475): New functions.
1128 (erc-server-412-hook, erc-server-432-hook, erc-server-475-hook):
1129 Use them.
1130 (erc-server-401, erc-server-403, erc-server-405)
1131 (erc-server-421, erc-server-474, erc-server-481): Use catalog
1132 messages.
1133 (erc-define-catalog): Added s401, s403, s405, s412, s421, s432,
1134 s474, s475, and s481.
1135
11362004-05-06 Diane Murray <disumu@x3y2z1.net>
1137
1138 * erc-nickserv.el: Added documentation to Commentary, Usage.
1139 Removed `outline-mode' from file local variables.
1140 (erc-services-mode): Use `erc-nickserv-identify-mode' to add
1141 hooks.
1142 (erc-nickserv-identify-mode): New function.
1143 (erc-nickserv-identify-mode): New variable.
1144 (erc-prompt-for-nickserv-password, erc-nickserv-passwords):
1145 Changed docstring.
1146 (erc-nickserv-identify-autodetect): Use
1147 `erc-nickserv-call-identify-function'. Docstring change.
1148 (erc-nickserv-identify-on-connect,
1149 erc-nickserv-identify-on-nick-change,
1150 erc-nickserv-call-identify-function): New functions.
1151 (erc-nickserv-identify): PASSWORD is not optional. Autoload
1152 function.
1153
11542004-05-05 Diane Murray <disumu@x3y2z1.net>
1155
1156 * erc.el (erc-join-hook, erc-quit-hook, erc-part-hook,
1157 erc-kick-hook, erc-connect-pre-hook): Now customizable.
1158 (erc-nick-changed-functions): New hook.
1159 (erc-server-NICK): Run `erc-nick-changed-functions' with the
1160 arguments NEW-NICK and OLD-NICK.
1161 (erc-channel-user-voice-p, erc-channel-user-voice-p): Shortened
1162 docstring.
1163
11642004-05-05 Lawrence Mitchell <wence@gmx.li>
1165
1166 * HACKING: New section on function/variable naming and coding
1167 conventions.
1168
11692004-05-05 Lawrence Mitchell <wence@gmx.li>
1170
1171 * erc.el (erc-wash-quit-reason): Quote regexp special characters
1172 in NICK, LOGIN and HOST.
1173
11742004-05-04 Diane Murray <disumu@x3y2z1.net>
1175
1176 * erc.el (erc-server-parameters): Typo fix in docstring.
1177 (erc-input-line-position): `:type' is now a choice between integer
1178 and nil. (erc-mode-map): Bind `erc-get-channel-mode-from-keypress'
1179 to C-c C-o instead of C-c RET (C-c C-m). (erc-cmd-GQUIT): Use
1180 REASON as argument when calling `erc-cmd-QUIT'.
1181
11822004-05-03 Lawrence Mitchell <wence@gmx.li>
1183
1184 * erc-nicklist.el: Initial version.
1185
11862004-04-28 Diane Murray <disumu@x3y2z1.net>
1187
1188 * erc-menu.el: Added local variables for file, fixed indenting.
1189 (erc-menu-version): New variable.
1190 (erc-menu-definition): "List channels": New. "Join channel": Use
1191 `erc-connected' as test. "Start a query": New. "List channel
1192 operators": New. "Input action": Moved up. "Set topic": Fixed
1193 test so it's only active in channels. "Leave this channel": Moved
1194 down. "Track hidden channel buffers": Removed. "Enable/Disable
1195 ERC Modules": New.
1196
11972004-04-28 Diane Murray <disumu@x3y2z1.net>
1198
1199 * erc.el (erc-mode-map): Removed binding for
1200 `erc-save-buffer-in-logs' (moved to erc-log.el).
1201 (erc-cmd-QUERY, erc-cmd-OPS): Now interactive.
1202
12032004-04-28 Diane Murray <disumu@x3y2z1.net>
1204
1205 * erc-log.el: Added local variables for this file.
1206 (erc-log-channels-directory): Added directory as a choice in
1207 `:type'.
1208 (define-erc-module): Define and undefine key binding (C-c
1209 C-l) for `erc-save-buffer-in-logs' here.
1210
12112004-04-28 Diane Murray <disumu@x3y2z1.net>
1212
1213 * erc-nets.el: Added local variables for this file.
1214 (erc-networks-alist): Fixed `:type' to work better in
1215 customization.
1216
12172004-04-28 Diane Murray <disumu@x3y2z1.net>
1218
1219 * erc-match.el: Added local variables for file. (erc-keywords):
1220 Use `list' instead of `cons' in `:type'. Fixes bug where mismatch
1221 was shown in customization. (erc-current-nick-highlight-type):
1222 Escape parentheses in docstring. Added keyword, nick-or-keyword as
1223 options in `:type'.
1224
12252004-04-28 Diane Murray <disumu@x3y2z1.net>
1226
1227 * erc-stamp.el: Added local variables for file.
1228 (erc-away-timestamp-format): Allow nil as a choice in `:type'.
1229 (erc-timestamp-intangible): Changed `:type' to boolean.
1230 (erc-timestamp-right-column): Added `:group' and `:type'.
1231
12322004-04-28 Diane Murray <disumu@x3y2z1.net>
1233
1234 * erc.el (erc-modules): Added bbdb, log, match, sound, and stamp
1235 as `:type' options; changed documentation for autojoin, fill,
1236 pcomplete, track. (erc-prompt-for-channel-key): New variable.
1237 (erc-join-channel): Only prompt for key if
1238 `erc-prompt-for-channel-key' is non-nil. (erc-format-my-nick): New
1239 function. (erc-send-message, erc-send-current-line): Use it.
1240
12412004-04-24 Johan Bockgard <bojohan@users.sourceforge.net>
1242
1243 * erc-track.el: (erc-track-modified-channels): Fix indentation.
1244
12452004-04-24 Johan Bockgard <bojohan@users.sourceforge.net>
1246
1247 * erc-match.el: (erc-hide-fools): Docstring fix.
1248 (erc-log-matches-types-alist): Added `current-nick' to valid
1249 choices.
1250
12512004-04-20 Diane Murray <disumu@x3y2z1.net>
1252
1253 * erc-page.el, erc-ezbounce.el, erc-speak.el, erc-match.el,
1254 erc-track.el (erc-ezbounce, erc-page, erc-speak): Groups defined.
1255 (erc-match, erc-track): `erc' is parent group.
1256 (erc-ezb-regexp, erc-ezb-login-alist): Added `:group'.
1257
12582004-04-20 Jorgen Schaefer <forcer@users.sourceforge.net>
1259
1260 * erc-fill.el: Fixed erc-fill-static so it breaks the lines at the
1261 right column and respects timestamps. Patch by Simon Siegler
1262 <simon@trz-kril.de>
1263 (erc-fill-static): Major rewrite and split up into some functions.
1264 (erc-count-lines): Removed.
1265 (erc-fill-regarding-timestamp): New function.
1266 (erc-timestamp-offset): New function.
1267 (erc-restore-text-properties): New function.
1268 (erc-fill-variable): Respect leftbound timestamp. This is still
1269 broken if someone has both erc-timestamp-only-if-changed-flag set
1270 and erc-insert-timestamp-function set to
1271 'erc-insert-timestamp-left, but otherwise it works now.
1272
12732004-04-20 Diane Murray <disumu@x3y2z1.net>
1274
1275 * erc.el: (erc-cmd-SV): Show features gtk, mac-carbon, multi-tty.
1276 Fixed so that arguments fit the format (build date was not being
1277 shown).
1278
12792004-04-19 Lawrence Mitchell <wence@gmx.li>
1280
1281 * erc.el: (erc-update-channel-topic); Error if `channel-topic' is
1282 unbound. Remove %-sign substitution.
1283 (erc-update-mode-line-buffer): Escape %-signs in `channel-topic'
1284 here.
1285
12862004-04-19 Diane Murray <disumu@x3y2z1.net>
1287
1288 * erc.el: (erc-send-action, erc-ctcp-query-ACTION,
1289 erc-ctcp-reply-ECHO-hook): Let `erc-display-message-highlight'
1290 propertize the message.
1291 (erc-display-message-highlight): Allow for any erc-TYPE-face.
1292 (erc-cmd-JOIN): Display error message instead of throwing an error
1293 if there's no `invitation'.
1294 (erc-cmd-PART): Allow for no reason if channel is provided. Fixes
1295 bug where user would part the current channel with the other
1296 channel's name as reason when no reason was given.
1297 (erc-server-vectors, erc-debug-missing-hooks): Added docstring.
1298 (erc-server-JOIN): Moved `erc-join-hook' to JOIN-you section.
1299 `erc-join-hook' called by `run-hook-with-args', sending the ARGS
1300 `chnl' and the channel's buffer. Changed an instance of if
1301 without else to when.
1302 (erc-server-477): New function.
1303 (erc-server-477-hook): Use `erc-server-477'.
1304 (erc-define-catalog): Added `no-invitation'.
1305
13062004-04-14 Diane Murray <disumu@x3y2z1.net>
1307
1308 * erc-nickserv.el: Local variables for file added.
1309 (erc-nickserv-passwords): Customization: Network symbols updated
1310 to reflect `erc-nickserv-alist'. Allow user to type in network
1311 symbol.
1312 (erc-nickserv-alist): Now customizable variable.
1313
13142004-04-09 Diane Murray <disumu@x3y2z1.net>
1315
1316 * erc-autoaway.el (erc-autoaway-reset-idletime): Make sure `line'
1317 is a string to avoid errors upon startup.
1318
13192004-04-06 Diane Murray <disumu@x3y2z1.net>
1320
1321 * erc-autoaway.el (erc-autoaway-version): New variable.
1322 (erc-auto-discard-away): Updated docstring.
1323 (erc-autoaway-no-auto-back-regexp): New variable.
1324 (erc-autoaway-reset-idletime): Use it. Hopefully a better solution
1325 which allows for aliases to "/away" and any other text that the
1326 user wants to ignore when `erc-auto-discard-away' is non-nil.
1327
13282004-04-06 Diane Murray <disumu@x3y2z1.net>
1329
1330 * erc-autoaway.el (erc-autoaway-reset-idletime): Forgot /gaway in
1331 regexp.
1332
13332004-04-06 Diane Murray <disumu@x3y2z1.net>
1334
1335 * erc-autoaway.el (erc-autoaway-reset-idletime): If the user sends
1336 an "/away" command, don't call `erc-autoaway-set-back', fixes bug
1337 where ERC would send "/away" when user was already away and sent an
1338 "/away reason". Changed `l' to `line' for better understanding.
1339 (erc-autoaway-set-back): Changed `l' to `line' for better
1340 understanding.
1341
13422004-04-05 Diane Murray <disumu@x3y2z1.net>
1343
1344 * erc.el (erc-set-channel-key): Now able to remove key.
1345 (erc-set-channel-limit): Now able to remove limit.
1346 (erc-get-channel-mode-from-keypress): Fixed docstring.
1347
13482004-04-04 Diane Murray <disumu@x3y2z1.net>
1349
1350 * erc.el (erc-join-channel): Allow for optional channel key.
1351 (erc-set-modes): Need to set `channel-key' to nil in case of mode
1352 changes during split.
1353 (erc-show-channel-key-p): New variable.
1354 (erc-prepare-mode-line-format): Only show key if
1355 `erc-show-channel-key-p' is non-nil.
1356
13572004-04-04 Diane Murray <disumu@x3y2z1.net>
1358
1359 * erc.el (channel-key): New variable.
1360 (erc-update-channel-key): New function.
1361 (erc-set-modes, erc-parse-modes, erc-update-modes, erc,
1362 erc-update-channel-info-buffer): Deal with channel keys.
1363 (erc-prepare-mode-line-format): Show channel key in header-line.
1364 (erc-server-NICK): Show nick change in server buffer as well.
1365 (erc, erc-send-command, erc-banlist-store, erc-banlist-update,
1366 erc-load-irc-script-lines,
1367 erc-arrange-session-in-multiple-windows, erc-handle-login,
1368 erc-find-channel-info-buffer): Changed when not to unless.
1369 (erc-server-MODE): Changed if without else to when.
1370
13712004-03-27 Adrian Aichner <adrian@xemacs.org>
1372
1373 * erc.el: (erc-cmd-BANLIST): Use `truncate-string-to-width'
1374 instead of `truncate-string' alias.
1375 (erc-nickname-in-use): Ditto.
1376
13772004-03-27 Francis Litterio <franl@users.sourceforge.net>
1378
1379 * erc-list.el (erc-cmd-list): Fixed error caused by erc-cmd-LIST
1380 passing a non-sequence to erc-chanlist.
1381
13822004-03-22 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1383
1384 * erc.el: Add new hook `erc-join-hook', which is run when we join a
1385 channel.
1386
13872004-03-22 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1388
1389 * erc.el: Replaced existing notice user notification system and
1390 the configuration options, which consisted of
1391 `erc-echo-notices-in-minibuffer-flag' and
1392 `erc-echo-notices-in-current-buffer' with two new hooks,
1393 `erc-echo-notice-hook' and `erc-echo-notice-always-hook'.
1394
1395 When user notification is needed, `erc-echo-notice-always-hook' is
1396 first run using `run-hook-with-args', then `erc-echo-notice-hook'
1397 is run using `run-hook-with-args-until-success'.
1398
1399 In addition to these hooks, a large number of functions, which are
1400 described in the documentation strings of those hooks, were added
1401 which can be used to achieve a large variety of different
1402 behaviors.
1403
1404 The current default behavior, which is identical to the existing
1405 default behavior, is for `erc-echo-notice-always-hook' to be set to
1406 `(erc-echo-notice-in-default-buffer).
1407
14082004-03-21 Diane Murray <disumu@x3y2z1.net>
1409
1410 * erc-track.el: (erc-modified-channels-display): Added a space
1411 before opening bracket.
1412
14132004-03-21 Diane Murray <disumu@x3y2z1.net>
1414
1415 * erc.el: (erc-format-query-as-channel-p): New variable.
1416 (erc-server-PRIVMSG-or-NOTICE): If `erc-format-query-as-channel-p'
1417 is nil, messages in the query buffer are formatted like private
1418 messages.
1419
1420 (erc-server-252-hook, erc-server-253-hook, erc-server-254-hook,
1421 erc-server-256-hook, erc-server-257-hook, erc-server-258-hook,
1422 erc-server-259-hook, erc-server-371-hook, erc-server-372-hook,
1423 erc-server-374-hook, erc-server-374-hook, erc-server-442-hook,
1424 erc-server-477-hook): Removed, now defined in
1425 `erc-server-hook-list'.
1426 (erc-display-server-message): New function.
1427 (erc-server-252, erc-server-253, erc-server-254, erc-server-442):
1428 New functions.
1429 (erc-server-hook-list): Added 250, 256, 257, 258, 259, 265, 266,
1430 377, 378, 477 - using `erc-display-server-message'. 251, 255 now
1431 use `erc-display-server-message'. Added 252, 253, 254, 442 -
1432 using respective erc-server-* functions. 371, 372, 374, 375 now
1433 defined here.
1434 (erc-define-catalog): Added s252, s253, s254, s442.
1435 (erc-server-001, erc-server-004, erc-server-005): Fixed
1436 documentation.
1437
14382004-03-20 Diane Murray <disumu@x3y2z1.net>
1439
1440 * erc-stamp.el: Commentary: Changed `erc-stamp-mode' to
1441 `erc-timestamp-mode'.
1442 (erc-insert-timestamp-left): Use `erc-timestamp-face' on filler
1443 spaces as well.
1444
14452004-03-19 Diane Murray <disumu@x3y2z1.net>
1446
1447 * erc.el (erc-send-action): Use `erc-input-face'.
1448 (erc-display-message-highlight): If the requested highlighting
1449 type doesn't match, just display the string with no highlighting
1450 and warn about it with `erc-log'.. (erc-cmd-JOIN): If user is
1451 already on the requested channel, switch to that channel's buffer.
1452 (erc-ctcp-query-ACTION): Use `erc-action-face' for nick as well.
1453 (erc-header-line-use-help-echo-p): New variable.
1454 (erc-update-mode-line-buffer): Use `help-echo' for header-line if
1455 `erc-header-line-use-help-echo-p' is non-nil.
1456
14572004-03-18 Adrian Aichner <adrian@xemacs.org>
1458
1459 * erc-nets.el: Use two arguments version of `make-obsolete', if
1460 third argument is not supported (for XEmacs).
1461
14622004-03-18 Andreas Fuchs <asf@void.at>
1463
1464 * CREDITS: added CREDITS entry for Adrian Aichner
1465
14662004-03-18 Andreas Fuchs <asf@void.at>
1467
1468 * erc-xdcc.el, erc.el, erc-autoaway.el, erc-autojoin.el,
1469 erc-button.el, erc-dcc.el, erc-ezbounce.el, erc-imenu.el,
1470 erc-list.el, erc-log.el, erc-match.el, erc-members.el,
1471 erc-menu.el, erc-netsplit.el, erc-notify.el, erc-speedbar.el,
1472 erc-stamp.el, erc-track.el, erc-truncate.el:
1473 (erc-coding-sytem-for-target): Removed.
1474 (erc-coding-system-for-target): New.
1475 (erc-autoaway-use-emacs-idle): Typo fix.
1476 (erc-auto-set-away): Ditto.
1477 (erc-auto-discard-away): Ditto.
1478 (autojoin): Ditto.
1479 (erc-button-alist): Ditto.
1480 (erc-dcc-auto-masks): Ditto.
1481 (erc-dcc-chat-send-input-line): Ditto.
1482 (erc-ezb-get-login): Ditto.
1483 (erc-unfill-notice): Ditto.
1484 (erc-save-buffer-in-logs): Ditto.
1485 (match): Ditto.
1486 (erc-log-matches-types-alist): Ditto.
1487 (erc-match-directed-at-fool-p): Ditto.
1488 (erc-match-message): Ditto.
1489 (erc-update-member): Ditto.
1490 (erc-ignored-reply-p): Ditto.
1491 (erc-menu-definition): Ditto.
1492 (erc-netsplit-QUIT): Ditto.
1493 (erc-notify-list): Ditto.
1494 (erc-speedbar-update-channel): Ditto.
1495 (erc-speedbar-item-info): Ditto.
1496 (erc-stamp): Ditto.
1497 (erc-timestamp-intangible): Ditto.
1498 (erc-add-timestamp): Ditto.
1499 (erc-timestamp-only-if-changed-flag): Ditto.
1500 (erc-show-timestamps): Ditto.
1501 (erc-track-priority-faces-only): Ditto.
1502 (erc-modified-channels-alist): Ditto.
1503 (erc-unique-substrings): Ditto.
1504 (erc-find-parsed-property): Ditto.
1505 (erc-track-switch-direction): Ditto.
1506 (erc-truncate-buffer-to-size): Ditto.
1507 (erc-xdcc): Ditto.
1508 (erc-auto-reconnect): Ditto.
1509 (erc-startup-file-list): Ditto.
1510 (erc-once-with-server-event): Ditto.
1511 (erc-once-with-server-event-global): Ditto.
1512 (erc-mode): Ditto.
1513 (erc-generate-new-buffer-name): Ditto.
1514 (erc): Ditto.
1515 (erc-open-ssl-stream): Ditto.
1516 (erc-default-coding-system): Ditto.
1517 (erc-encode-string-for-target): Ditto.
1518 (erc-decode-string-from-target): Ditto.
1519 (erc-scroll-to-bottom): Ditto.
1520 (erc-decode-controls): Ditto.
1521 (erc-channel-members-changed-hook): Ditto.
1522 (erc-put-text-property): Ditto.
1523 (erc-add-default-channel): Ditto.
1524
15252004-03-17 Diane Murray <disumu@x3y2z1.net>
1526
1527 * erc.el (erc-process-sentinel): Cancel ping timer upon
1528 disconnect.
1529 (erc-cmd-PART): Use same regexp as `erc-cmd-QUIT' when no #channel
1530 is provided.
1531 (erc-nick-uniquifier, erc-manual-set-nick-on-bad-nick-p): `:group'
1532 was missing, added.
1533 (erc-part-reason-zippy, erc-part-reason-zippy): Removed FIXME
1534 comments. I see no problem allowing typed in reasons.
1535
15362004-03-16 Diane Murray <disumu@x3y2z1.net>
1537
1538 * erc-stamp.el: (erc-insert-timestamp-left): Added support for
1539 `erc-timestamp-only-if-changed-flag' and added docstring.
1540 (erc-timestamp-only-if-changed-flag): Updated documentation.
1541
15422004-03-13 Francis Litterio <franl@users.sourceforge.net>
1543
1544 * erc-nets.el (erc-network-name): No longer marked as obsolete.
1545 Why was this function made obsolete? There is no other function
1546 that performs this task. Some of us use these functions in our
1547 personal ERC configs.
1548
15492004-03-12 Lawrence Mitchell <wence@gmx.li>
1550
1551 * erc.el (erc-buffer-filter): Use `with-current-buffer'.
1552 (erc-process-input-line): Append newline to documentation. Fixes a
1553 bug whereby the prompt would be put on the same line as the output.
1554 (erc-cmd-GQUIT): Only try and send QUIT if the process is alive.
1555
15562004-03-12 Lawrence Mitchell <wence@gmx.li>
1557
1558 * erc-log.el: Only add top-level hooks if `erc-enable-logging' is
1559 non-nil.
1560
15612004-03-10 Damien Elmes <erc@repose.cx>
1562
1563 * erc-nets.el: From Adrian Aichner (adrian /at/ xemacs /dot/ org)
1564 * erc-nets.el: XEmacs make-obsolete only takes two arguments.
1565
15662004-03-10 Diane Murray <disumu@x3y2z1.net>
1567
1568 * erc-nets.el (erc-determine-network): Use `erc-session-server' if
1569 `erc-announced-server' is nil to avoid error if server does not
1570 send 004 (RPL_MYINFO) message.
1571
15722004-03-10 Lawrence Mitchell <wence@gmx.li>
1573
1574 * erc-nets.el (erc-server-alistm erc-settings): Use lowercase
1575 "freenode", as in `erc-networks-alist'.
1576
15772004-03-10 Lawrence Mitchell <wence@gmx.li>
1578
1579 * erc-nickserv.el (erc-nickserv-alist): Use lowercase "freenode",
1580 as in `erc-networks-alist'.
1581
15822004-03-10 Lawrence Mitchell <wence@gmx.li>
1583
1584 * erc-dcc.el (pcomplete/erc-mode/DCC): Append "send" as a list.
1585
15862004-03-10 Francis Litterio <franl@users.sourceforge.net>
1587
1588 * erc-nets.el (erc-networks-alist): Changed "Freenode" to
1589 "freenode".
1590
15912004-03-10 Francis Litterio <franl@users.sourceforge.net>
1592
1593 * erc-list.el (erc-cmd-LIST): Improved the docstring. Made
1594 message to user more accurate depending on whether a single
1595 channel is being listed or not.
1596
15972004-03-10 Lawrence Mitchell <wence@gmx.li>
1598
1599 * erc-nets.el (erc-determine-network): Make matching logic simpler
1600 (suggested by Damian Elmes).
1601 (erc-current-network, erc-network-name): Add `make-obsolete' form.
1602 (erc-set-network-name): Indentation fix.
1603 (erc-ports-list): Add docstring. Rework function body to use
1604 `nconc'.
1605
16062004-03-09 Diane Murray <disumu@x3y2z1.net>
1607
1608 * erc-list.el, erc-notify.el: (require 'erc-nets): added
1609
16102004-03-08 Diane Murray <disumu@x3y2z1.net>
1611
1612 * erc.el (erc-network-name): Function definition moved to
1613 erc-nets.el. The functions `erc-determine-network' and
1614 `èrc-network' in erc-nets.el do what this did before. Deprecated.
1615 Use (erc-network) instead.
1616
16172004-03-08 Diane Murray <disumu@x3y2z1.net>
1618
1619 * erc-nickserv.el: Changed copyright notice. Now require
1620 erc-nets. erc-nets.el now takes care of network-related functions
1621 and variables.
1622 (erc-nickserv-alist): Changed network symbols to match those in
1623 `erc-networks-alist' in erc-nets.el.
1624 (erc-nickserv-identify-autodetect): Use `erc-network'.
1625 (erc-nickserv-identify): Use `erc-network'. Changed wording for
1626 interactive use, now shows current nick.
1627 (erc-networks): Removed. Use `erc-networks-alist' as defined in
1628 erc-nets.el.
1629 (erc-current-network): Function definition moved to erc-nets.el.
1630 The functions `erc-determine-network' and `èrc-network' in
1631 erc-nets.el do what this did before. Deprecated. Use
1632 (erc-network) instead.
1633
16342004-03-08 Diane Murray <disumu@x3y2z1.net>
1635
1636 * erc-nets.el: Added commentary, `erc-nets-version'.
1637 (erc-server-alist): Changed Brasnet to BRASnet.
1638 (erc-networks-alist): All networks (except EFnet and IRCnet) now
1639 have a MATCHER. (erc-network): New variable.
1640 (erc-determine-network): New function. Determine the network the
1641 user is on. Use the server parameter NETWORK, if provided, else
1642 parse the server name and search for a match (regexp and loop by
1643 wencem) in `erc-networks-alist'. Return the name of the network
1644 or "Unknown" as a symbol.
1645 (erc-network): New function. Returns value of `erc-network'. Use
1646 this when the current buffer is not the server process buffer.
1647 (erc-current-network): Returns the value of `erc-network' as
1648 expected by users who used the function as it was defined in
1649 erc-nickserv.el. Deprecated.
1650 (erc-network-name): Returns the value of `erc-network' as expected
1651 by users who used the function as it was defined in erc.el.
1652 Deprecated.
1653 (erc-set-network-name): New function. Added to
1654 `erc-server-375-hook' and `erc-server-422-hook'.
1655 (erc-unset-network-name): New function. Added to
1656 `erc-disconnected-hook'.
1657 (erc-server-select): Small documentation word change.
1658
16592004-03-07 Diane Murray <disumu@x3y2z1.net>
1660
1661 * AUTHORS, CREDITS: disumu info updated
1662
16632004-03-06 Lawrence Mitchell <wence@gmx.li>
1664
1665 * erc-list.el (erc-cmd-LIST): Take &rest rather than &optional
1666 arguments.
1667 (erc-chanlist): Construct correct LIST command from list of
1668 channels.
1669
16702004-03-06 Lawrence Mitchell <wence@gmx.li>
1671
1672 * erc.el (erc-update-mode-line-buffer): Add 'help-echo property to
1673 header-line text. This allows header lines longer than the width
1674 of the current window to be seen.
1675
16762004-03-06 Jorgen Schaefer <forcer@users.sourceforge.net>
1677
1678 * erc-match.el (erc-match-directed-at-fool-p): Also check for
1679 "FOOL, "
1680
16812004-03-06 Jorgen Schaefer <forcer@users.sourceforge.net>
1682
1683 * erc-match.el (erc-match-message): Only use nick-or-keyword if
1684 we're matching our nick.
1685
16862004-03-06 Jorgen Schaefer <forcer@users.sourceforge.net>
1687
1688 * erc-match.el: The highlight type for the current nickname can
1689 now also be 'nick-or-keyword, to highlight the nick of the sender
1690 if that is available, but fall back to highlighting your nickname
1691 in the whole message otherwise.
1692 (erc-current-nick-highlight-type): Adapted docstring accordingly.
1693 (erc-match-message): Added new condition. Also added some comments
1694 to this monster of a function.
1695
16962004-03-06 Jorgen Schaefer <forcer@users.sourceforge.net>
1697
1698 * erc.el (erc-is-valid-nick-p): Don't check for length less or
1699 equal to 9.
1700
17012004-03-06 Damien Elmes <erc@repose.cx>
1702
1703 * erc-nickserv.el (erc-current-network): the last change resulted
1704 in this function failing when a network identifies itself as
1705 anything other than var.netname.com, so for instance
1706 'vic.au.austnet.org' fails. This version is only a marginal
1707 improvement over the original, but if we want to be more flexible
1708 we'll probably have to do the iteration ourselves instead of using
1709 assoc.
1710
17112004-03-05 Diane Murray <disumu@x3y2z1.net>
1712
1713 * erc.el: Added erc-server-001 which runs when the server sends
1714 its welcome message. It sets the current-nick to reflect the
1715 server's settings. This fixes a bug where nicks that were too long
1716 and got truncated by ther server were still set to the old value.
1717 (nickname-in-use): If user wants to try again manually, let user
1718 know that the nick is taken. If not, go through erc-default-nicks
1719 until none are left, and then try one last time with
1720 erc-nick-uniquifier. If it's still a bad-nick, make the user
1721 change nick manually. When applying uniquifier, use NICKLEN if
1722 it's in the server parameters, otherwise use what RFC 2812 says is
1723 the max nick length (9 chars). Added custom variable
1724 erc-manual-set-nick-on-bad-nick-p, which is set to nil and
1725 erc-nick-change-attempt-count. Reset erc-default-nicks and
1726 erc-nick-change-attempt-count when the nick has been changed
1727 successfully. This fixes the bug where ERC would get caught in a
1728 neverending loop of trying to set the same nick if the nick was
1729 too long and the uniquified nick was not available.
1730
1731 * added erc-cmd-WHOAMI
1732
1733 * added custom variable erc-mode-line-away-status-format, use this
1734 instead of the previous hard-coded setting
1735
1736 * erc-server-315|318|369-hook defvar lines removed - they're
1737 already defined in erc-server-hook-list
1738
17392004-03-04 Lawrence Mitchell <wence@gmx.li>
1740
1741 * HACKING: Initial commit. Some thoughts on coding standards.
1742
17432004-03-03 Diane Murray <disumu@x3y2z1.net>
1744
1745 * erc-track.el: added the variable erc-track-priority-faces-only
1746 which adds the option to ignore changes in a channel unless there
1747 are faces from the erc-track-faces-priority-list in the message
1748 options are nil, 'all, or a list of channel name strings
1749
17502004-03-01 Diane Murray <disumu@x3y2z1.net>
1751
1752 * erc.el, erc-ibuffer.el, erc-menu.el: Changed erc-is-channel-op
1753 and erc-is-channel-voice to erc-channel-user-op-p and
1754 erc-channel-user-voice-p to better match erc-channel-user
1755 structure (and emacs lisp usage)
1756
17572004-03-01 Diane Murray <disumu@x3y2z1.net>
1758
1759 * erc.el, erc-ibuffer.el, erc-menu.el:
1760 erc-track-modified-channels-mode is now erc-track-mode
1761
17622004-02-29 Diane Murray <disumu@x3y2z1.net>
1763
1764 * erc-match.el: Added 'keyword option to
1765 erc-current-nick-highlight-type highlights all instances of
1766 current-nick in the message ('nickname option in cvs revisions 1.9
1767 - 1.11 had same effect)
1768
17692004-02-28 Jorgen Schaefer <forcer@users.sourceforge.net>
1770
1771 * erc-button.el: Add Lisp: prefix for the EmacsWiki Elisp area.
1772 (erc-button-alist): Added Lisp: prefix.
1773 (erc-emacswiki-lisp-url): New variable.
1774 (erc-browse-emacswiki-lisp): New function.
1775
17762004-02-27 Lawrence Mitchell <wence@gmx.li>
1777
1778 * erc.el (erc-get-arglist): Use `substitute-command-keys', rather
1779 than hard-coding C-h f for `describe-function'.
1780
17812004-02-26 Johan Bockgard <bojohan@users.sourceforge.net>
1782
1783 * erc-log.el (erc-save-buffer-in-logs): bind `inhibit-read-only'
1784 to t around call to `erase-buffer'.
1785
17862004-02-23 Edward O'Connor <ted@oconnor.cx>
1787
1788 * erc-chess.el, erc-dcc.el, erc-ezbounce.el, erc-list.el,
1789 erc-macs.el, erc-ring.el, erc-stamp.el, erc.el: Normalized buffer
1790 local variable creation.
1791
17922004-02-17 Lawrence Mitchell <wence@gmx.li>
1793
1794 * erc.el (erc-scroll-to-bottom, erc-add-scroll-to-bottom): Mention
1795 `erc-input-line-position' in docstring.
1796
17972004-02-13 Jorgen Schaefer <forcer@users.sourceforge.net>
1798
1799 * erc.el (erc-kick-hook): Typo fix.
1800
18012004-02-13 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1802
1803 * erc.el: Added `erc-kick-hook', which is called when the local
1804 user is kicked from a channel. Fixed a bug in `erc-cmd-OPS', such
1805 that the command now works. Added `erc-remove-channel-users', in
1806 order to fix a number of significant bugs relating to channel
1807 parting.
1808
18092004-02-12 Jorgen Schaefer <forcer@users.sourceforge.net>
1810
1811 * erc.el (erc-display-prompt): Remove last change. This caused a
1812 lot of trouble :(
1813
18142004-02-12 Jorgen Schaefer <forcer@users.sourceforge.net>
1815
1816 * erc.el (erc-display-prompt): Also set 'field property, so C-j
1817 works on an empty prompt.
1818
18192004-02-12 Lawrence Mitchell <wence@gmx.li>
1820
1821 * erc.el (erc-update-channel-topic): Ensure that `channel-topic'
1822 does not contain any bare format controls.
1823
18242004-02-10 Jorgen Schaefer <forcer@users.sourceforge.net>
1825
1826 * erc-stamp.el (erc-timestamp-intangible): New variable (user
1827 feature request)
1828 (erc-format-timestamp): Use erc-timestamp-intangible.
1829
18302004-02-07 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1831
1832 * erc-button.el: Fixed bug related to nickname buttonizing and text
1833 fields due to erc-stamp.
1834
18352004-02-07 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1836
1837 * CREDITS: Added mention of my change of ERC to use hash tables.
1838
18392004-02-07 Jeremy Bertram Maitin-Shepard <jbms@gentoo.org>
1840
1841 * AUTHORS: Added myself to the list.
1842
18432004-02-05 Lawrence Mitchell <wence@gmx.li>
1844
1845 * erc.el: From Jeremy Maitin-Shepard <jbms@attbi.com>:
1846 (erc-remove-channel-user): Use `delq' not `delete'.
1847 (erc-get-buffer): Pass PROC through to `erc-buffer-filter'.
1848 (erc-process-sentinel): Use `erc' rather than `erc-reconnect' for
1849 auto-reconnection.
1850
18512004-02-02 Lawrence Mitchell <wence@gmx.li>
1852
1853 * erc.el: (erc-buffer-list-with-nick): Apply `erc-downcase' NICK.
1854
18552004-01-30 Alex Schroeder <alex@gnu.org>
1856
1857 * erc.el: (erc-get-buffer): Use erc-buffer-filter.
1858
18592004-01-30 Johan Bockgard <bojohan@users.sourceforge.net>
1860
1861 * erc.el: From jbms: (erc-get-channel-nickname-list): New function.
1862 (erc-get-server-nickname-list): New function.
1863 (erc-get-server-nickname-alist): New function.
1864 (erc-get-channel-nickname-alist): New function.
1865
18662004-01-30 Johan Bockgard <bojohan@users.sourceforge.net>
1867
1868 * erc-match.el: (erc-add-entry-to-list,
1869 erc-remove-entry-from-list): Use `erc-member-ignore-case' to
1870 compare entries.
1871 (erc-add-pal, erc-add-fool): Fix type bug. Use
1872 `erc-get-server-nickname-alist'.
1873
18742004-01-29 Johan Bockgard <bojohan@users.sourceforge.net>
1875
1876 * erc.el: From jbms: Adds xemacs compatibility to hash table
1877 channel-members patch.
1878
18792004-01-29 Johan Bockgard <bojohan@users.sourceforge.net>
1880
1881 * erc.el: (erc-update-undo-list): Rewritten. Update
1882 buffer-undo-list in place. Deal with XEmacsesque
1883 entries (extents) in the list.
1884 (erc-channel-users): Fix unescaped open-paren in left column in
1885 docstring.
1886
18872004-01-29 Johan Bockgard <bojohan@users.sourceforge.net>
1888
1889 * erc-ring.el: (erc-replace-current-command): Exclude the prompt
1890 from the deleted region and don't redisplay the prompt (because
1891 `erc-display-prompt' flushes `buffer-undo-list').
1892
18932004-01-29 Johan Bockgard <bojohan@users.sourceforge.net>
1894
1895 * erc-match.el: (erc-add-entry-to-list): Use `symbol-value' instead
1896 of `eval'.
1897
18982004-01-28 Jorgen Schaefer <forcer@users.sourceforge.net>
1899
1900 * erc.el: (erc-kill-buffer-function): maphash was missing an
1901 argument.
1902
19032004-01-28 Jorgen Schaefer <forcer@users.sourceforge.net>
1904
1905 * Makefile, erc-autoaway.el, erc-button.el, erc-ibuffer.el,
1906 erc-lang.el, erc-list.el, erc-match.el, erc-menu.el, erc-page.el,
1907 erc-pcomplete.el, erc-speedbar.el, erc.el: HUGE change by jbms.
1908 This makes channel-members a hash, erc-channel-users.
1909
1910 Modified files: Makefile erc-autoaway.el erc-button.el
1911 erc-ibuffer.el erc-lang.el erc-list.el erc-match.el erc-menu.el
1912 erc-page.el erc-pcomplete.el erc-speedbar.el erc.el
1913
1914 The changes are too numerous to document properly. Have fun with
1915 the breakage.
1916
19172004-01-27 Jorgen Schaefer <forcer@users.sourceforge.net>
1918
1919 * erc.el: (erc-send-input-line): Add a space to empty lines so the
1920 server likes them.
1921
19222004-01-25 Jorgen Schaefer <forcer@users.sourceforge.net>
1923
1924 * erc.el: erc-send-whitespace-lines: New variable.
1925 (erc-send-current-line): Use erc-send-whitespace-lines. Also,
1926 removed superflous test for empty line in the mapc, since the
1927 blank line test should find all. I do like to be able to send an
1928 empty line when i want to!
1929 (erc-send-current-line): Check for point being in input line
1930 before checking for blank lines.
1931
19322004-01-21 Lawrence Mitchell <wence@gmx.li>
1933
1934 * erc.el: (erc-display-line-1): Move `erc-update-undo-list' outside
1935 `save-restriction'. Removing need for temporary variable.
1936 (erc-send-current-line): Fix bug introduced by last change, remove
1937 complement in blank line regexp.
1938
19392004-01-20 Lawrence Mitchell <wence@gmx.li>
1940
1941 * erc.el: (erc-update-undo-list): Add logic to catch the case when
1942 `buffer-undo-list' is t, indentation cleanup.
1943 (erc-send-current-line): Reverse logic for matching blank lines.
1944
19452004-01-20 Lawrence Mitchell <wence@gmx.li>
1946
1947 * erc.el (erc-input-line-position): New variable. If non-nil,
1948 specifies the argument to `recenter' in `erc-scroll-to-bottom'.
1949 (erc-scroll-to-bottom): Use it.
1950
19512004-01-20 Lawrence Mitchell <wence@gmx.li>
1952
1953 * erc.el: From Johan Bockgård <bojohan+news@dd.chalmers.se>:
1954 (erc-update-undo-list): New function. Update `buffer-undo-list'
1955 so that calling `undo' in an ERC buffer doesn't mess up the
1956 existing text.
1957 (erc-display-line-1): Use it.
1958
19592004-01-19 Lawrence Mitchell <wence@gmx.li>
1960
1961 * erc.el (erc-beg-of-input-line): Use `forward-line' rather than
1962 `beginning-of-line'. Docstring fix.
1963 (erc-end-of-input-line): Docstring fix.
1964
19652004-01-13 Jorgen Schaefer <forcer@users.sourceforge.net>
1966
1967 * erc.el (erc-display-prompt): Remove the undo list after
1968 displaying the prompt, so the user can't undo ERC changes, which
1969 breaks some stuff anyways. This way the user can still undo his
1970 editing, but not ours.
1971
19722004-01-12 Jorgen Schaefer <forcer@users.sourceforge.net>
1973
1974 * erc.el (erc-scroll-to-bottom): Should recenter on the bottom
1975 line, not the second-to-last one.
1976
19772004-01-12 Lawrence Mitchell <wence@gmx.li>
1978
1979 * erc.el: (erc-bol): Fix bug introduced in my changes from 2004-01-11.
1980
19812004-01-12 Lawrence Mitchell <wence@gmx.li>
1982
1983 * erc.el: From Brian Palmer <bpalmer@gmail.com>
1984 (erc-cmd-JOIN): Use `erc-member-ignore-case', rather than
1985 `member-ignore-case'.
1986
19872004-01-12 Jorgen Schaefer <forcer@users.sourceforge.net>
1988
1989 * erc.el: There was an inconsistency where the values of op and
1990 voice in channel-names could be 'on or 'off after an update, t and
1991 nil before. The intended version was to have t or nil, so i fixed
1992 it to do so.
1993 (channel-names): Updated docstring.
1994 (erc-update-current-channel-member): Clarified docstring, fixed so
1995 it sets t or nil on an update as well, not only on an add.
1996 (erc-cmd-OPS): Updated not to check for 'on (the only function that
1997 did this!)
1998
19992004-01-12 Lawrence Mitchell <wence@gmx.li>
2000
2001 * erc.el (erc-part-reason-various-alist,
2002 erc-update-mode-line-buffer): Fix docstring
2003
20042004-01-11 Lawrence Mitchell <wence@gmx.li>
2005
2006 * erc.el (erc-update-mode-line): Fix typo.
2007
20082004-01-11 Lawrence Mitchell <wence@gmx.li>
2009
2010 * erc.el (erc-prompt-interactive-input): Removed.
2011 (erc-display-prompt): Removed `erc-prompt-interactive-input'
2012 option. (erc-interactive-input-map): Removed.
2013
2014 Major docstring fixes.
2015
20162004-01-07 Francis Litterio <franl@users.sourceforge.net>
2017
2018 * erc.el (erc-cmd-OPS): Added this function.
2019 (erc-cmd-IDLE): Switched from using erc-display-message-highlight
2020 to erc-make-notice.
2021
20222004-01-07 Francis Litterio <franl@users.sourceforge.net>
2023
2024 * erc-list.el (erc-cmd-LIST): Switched from using
2025 erc-display-message-highlight to erc-make-notice.
2026
20272004-01-07 Francis Litterio <franl@users.sourceforge.net>
2028
2029 * erc.el (erc-once-with-server-event): Added a sentence to the
2030 docstring. Now returns the uninterned symbol that is added to the
2031 server hook.
2032 (erc-cmd-IDLE): Changed to use erc-once-with-server-event instead
2033 of erc-once-with-server-event-global.
2034
20352004-01-06 Francis Litterio <franl@users.sourceforge.net>
2036
2037 * erc-list.el (erc-chanlist-hide-modeline): New variable.
2038 (erc-chanlist): Now displays message as a notice. Also hides the
2039 modeline if erc-chanlist-hide-modeline is non-nil.
2040
20412004-01-05 Francis Litterio <franl@users.sourceforge.net>
2042
2043 * erc.el (erc-server-PRIVMSG-or-NOTICE): Now nicks appear as
2044 <nick> in query buffers, instead of as *nick*.
2045
20462004-01-03 Francis Litterio <franl@users.sourceforge.net>
2047
2048 * erc.el (erc-once-with-server-event-global): Changed to return
2049 the uninterned symbol that it creates.
2050 (erc-cmd-LIST): Changed to clean up hooks that don't run.
2051
20522004-01-03 Francis Litterio <franl@users.sourceforge.net>
2053
2054 * erc-pcomplete.el (pcomplete/erc-mode/IDLE): Added to support new
2055 /IDLE command.
2056
20572004-01-03 Francis Litterio <franl@users.sourceforge.net>
2058
2059 * erc.el (erc-once-with-server-event-global): New function. Like
2060 erc-once-with-server-event, except it modifies the global value of
2061 the event hook.
2062 (erc-cmd-IDLE): New function. Implements the new /IDLE command.
2063 Usage: /IDLE NICK (erc-seconds-to-string): New function. Converts
2064 a number of seconds to an Engligh phrase.
2065
20662004-01-02 Francis Litterio <franl@users.sourceforge.net>
2067
2068 * erc-list.el: Added variable erc-chanlist-mode-hook.
2069
2070 Copyright (C) 2004 Free Software Foundation, Inc.
2071 Copying and distribution of this file, with or without modification,
2072 are permitted provided the copyright notice and this notice are preserved.
2073
2074;; arch-tag: cc606d2d-635b-4b36-829b-a50e3c51e2d1
diff --git a/lisp/erc/ChangeLog.2005 b/lisp/erc/ChangeLog.2005
new file mode 100644
index 00000000000..2895306e86a
--- /dev/null
+++ b/lisp/erc/ChangeLog.2005
@@ -0,0 +1,1222 @@
12005-11-23 Johan Bockgård <bojohan@users.sourceforge.net>
2
3 * erc.el (erc-cmd-SAY): Strip leading space in input line.
4
52005-10-29 Michael Olson <mwolson@gnu.org>
6
7 * FOR-RELEASE: Add stuff that needs to be done before the 5.1
8 release. Longer-term items can be added to the 5.2 section.
9
10 * Makefile (SITEFLAG): New variable that indicates what variant of
11 "--site-flag" to use. XEmacs needs "-site-flag".
12 (INSTALLINFO): New variable indicating how we should call
13 install-info when installing documentation.
14 (erc-auto.el, .elc.el): Use $(SITEFLAG).
15
16 * NEWS: Note that last release was 5.0.4.
17
18 * erc.texi: Initial and incomplete draft of ERC documentation.
19 Commence collaborate-documentation-hack-mode :^) .
20
212005-10-29 Diane Murray <disumu@x3y2z1.net>
22
23 * erc-ring.el (erc-replace-current-command): Revert last change
24 since it made the prompt disappear when using `erc-next-command'
25 and `erc-previous-command'.
26
272005-10-28 Michael Olson <mwolson@gnu.org>
28
29 * erc.el (erc-input-marker): New variable that indicates the
30 position where text from the user begins, after the prompt.
31 (erc-mode-map): Bind <HOME> to erc-bol, just like C-a.
32 (erc): Initialize erc-input-marker.
33 (erc-display-prompt): Even in case where no prompt is desired by
34 the user, clear the undo buffer and set the input marker.
35 (erc-bol, erc-user-input): Simplify by using erc-input-marker.
36
37 * erc-pcomplete.el (pcomplete-parse-erc-arguments): Use
38 erc-insert-marker.
39
40 * erc-ring.el (erc-previous-command)
41 (erc-replace-current-command): Use erc-insert-marker.
42
43 * erc-spelling.el (erc-spelling-init): Make sure that even Emacs21
44 obeys erc-spelling-flyspell-verify.
45 (erc-spelling-flyspell-verify): Use erc-input-marker. This should
46 make it considerably faster when switching to a buffer that has
47 seen a lot of activity since last viewed.
48
492005-10-25 Diane Murray <disumu@x3y2z1.net>
50
51 * erc-backend.el (erc-server-version, 004): Re-added setting of
52 `erc-server-version'. It doesn't hurt to set, and it could be
53 used in modules or users' settings.
54
55 * NEWS: Added descriptions of some new features.
56
572005-10-20 Diane Murray <disumu@x3y2z1.net>
58
59 * erc-match.el (erc-current-nick-highlight-type): Set to `keyword'
60 as default.
61 (erc-beep-match-types): New variable.
62 (erc-text-matched-hook): Doc fix. Added `erc-beep-on-match' to
63 customization options.
64 (erc-beep-on-match): New function. If the MATCH-TYPE is found in
65 `erc-beep-match-types', beep.
66
67 * erc-compat.el (erc-make-obsolete, erc-make-obsolete-variable):
68 New functions to deal with the difference in the number of
69 arguments accepted by `make-obsolete' and `make-obsolete-variable'
70 in Emacs and XEmacs.
71
72 * erc.el, erc-nets.el: Use `erc-make-obsolete' and
73 `erc-make-obsolete-variable'.
74
75 * erc-compat.el (erc-make-obsolete, erc-make-obsolete-variable):
76 Handle `wrong-number-of-arguments' error instead of checking for
77 xemacs feature as future versions of XEmacs might accept three
78 arguments.
79
802005-10-18 Edward O'Connor <ted@oconnor.cx>
81
82 * erc.el: Tell emacs-lisp-mode how to font-lock define-erc-module
83 docstrings.
84
852005-10-08 Diane Murray <disumu@x3y2z1.net>
86
87 * AUTHORS, CREDITS, ChangeLog, ChangeLog.2002, ChangeLog.2004:
88 Updated my email address.
89
902005-10-06 Michael Olson <mwolson@gnu.org>
91
92 * erc.el (erc-send-input-line, erc-cmd-KICK, erc-cmd-PART)
93 (erc-cmd-QUIT, erc-cmd-TOPIC, erc-kill-server, erc-kill-channel):
94 Adapt to new TARGET parameter of erc-server-send.
95
96 * erc-backend.el (erc-server-connect): Don't specify encoding for
97 erc-server-process, since we set this each time we send a line to
98 the server.
99 (erc-encode-string-for-target): Remove.
100 (erc-server-send): Allow TARGET to be specified. This was how it
101 used to be before my more-backend work. Set encoding of server
102 process just before sending text to it. Associate encoding with
103 text if we are using the queue.
104 (erc-server-send-queue): Pull encoding from queue.
105 (erc-message, erc-send-ctcp-message, erc-send-ctcp-notice): Adapt
106 to new TARGET parameter of erc-server-send.
107
1082005-10-05 Michael Olson <mwolson@gnu.org>
109
110 * erc.el (erc-toggle-debug-irc-protocol): Use erc-view-mode-enter
111 rather than view-mode.
112
113 * erc-backend.el (erc-encode-string-for-target): If given a nil or
114 empty string, return "".
115 (erc-server-send-queue): XEmacs fix: Use erc-cancel-timer rather
116 than cancel-timer.
117
118 * erc-compat.el (erc-view-mode-enter): New function that is
119 aliased to the correct way of entering view-mode.
120
121 * erc-match.el (erc-log-matches-make-buffer): Use
122 erc-view-mode-enter rather than view-mode-enter.
123
1242005-10-05 Edward O'Connor <ted@oconnor.cx>
125
126 * erc-backend.el (erc-encode-string-for-target): If str is nil,
127 pass the empty string to erc-encode-coding-string instead, which
128 allows one to /part and /quit without providing a reason again.
129
1302005-10-03 Michael Olson <mwolson@gnu.org>
131
132 * erc-backend.el (erc-message, erc-send-ctcp-message)
133 (erc-send-ctcp-notice): Encode string for target before sending.
134
135 * erc.el (erc-cmd-KICK, erc-cmd-PART, erc-cmd-QUIT, erc-cmd-TOPIC)
136 (erc-kill-server, erc-kill-channel): Ditto.
137
1382005-09-05 Johan Bockgård <bojohan@users.sourceforge.net>
139
140 * erc-page.el (erc-ctcp-query-PAGE): (message text) -> (message
141 "%s" text).
142 (erc-cmd-PAGE): Simplify regexp. Put `do-not-parse-args' t.
143
1442005-09-05 Michael Olson <mwolson@gnu.org>
145
146 * erc.el (erc-flood-limit, erc-flood-limit2): Remove since they
147 are no longer needed.
148 (erc-send-input): Detect whether we want flood control to be
149 active. The previous behavior was to always force the message.
150 (erc-toggle-flood-control): Adapt to new flood control method. No
151 more 'strict.
152 (erc-cmd-SV): Use concat rather than
153 format-time-string.
154 (erc-format-target, erc-format-target-and/or-server): Shorten
155 logic statements.
156
157 * erc-compat.el (erc-emacs-build-time): Use a string
158 representation rather than trying to coerce a time out of a string
159 on XEmacs.
160
161 * erc-identd.el (erc-identd-start): Use make-network-process
162 instead of open-network-stream. Error out if this is not defined.
163
164 * erc-backend.el (erc-send-line): New command that sends a line
165 using flood control, using a callback for display. It isn't used
166 yet.
167
1682005-09-04 Michael Olson <mwolson@gnu.org>
169
170 * erc.el: Add defvaralias and make-obsolete-variable for
171 erc-default-coding-system.
172 (channel-topic, channel-modes, channel-user-limit, channel-key,
173 invitation, away, channel-list, bad-nick): Rename globally to
174 erc-{name-of-variable}.
175
1762005-09-03 Johan Bockgård <bojohan@users.sourceforge.net>
177
178 * erc.el (erc-message): Simplify regexp.
179 (erc-cmd-DEOP, erc-cmd-OP): Simplify.
180
1812005-08-29 Michael Olson <mwolson@gnu.org>
182
183 * erc.el: Alias erc-send-command to erc-server-send. ErBot needs
184 this to work without modification. Add defvaralias for
185 erc-process. Make this and the other backwards-compatibility
186 functions and variables be marked obsolete as of ERC 5.1.
187
188 * erc-backend.el: Add autoload for erc-log macro.
189 (erc-server-connect): Set some variables before defining process
190 handlers. It probably doesn't make any difference.
191
1922005-08-26 Michael Olson <mwolson@gnu.org>
193
194 * erc.el: Add defvaralias for erc-announced-server-name, since
195 this seems to be widely used.
196
1972005-08-17 Michael Olson <mwolson@gnu.org>
198
199 * erc.el (erc): Remove unnecessary boundp check.
200
201 * erc-autoaway.el: Fix compiler warning.
202
203 * erc-backend.el (erc-server-version): Since this isn't used by
204 any code, and isn't generally useful, remove it.
205 (erc-server-send-queue): Use erc-current-time rather than
206 float-time.
207 (004): Don't set erc-server-version.
208
209 * erc-dcc.el (erc-dcc-chat-request, erc-dcc-get-parent): Move to
210 fix a compiler warning.
211
212 * erc-ibuffer.el (erc-server): Remove unnecessary boundp check.
213
214 * erc-identd.el (erc-identd-start): Use read-string instead of
215 read-input.
216
217 * erc-imenu.el (erc-unfill-notice): Use a while loop instead of
218 replace-regexp.
219
220 * erc-nicklist.el: Add conditional dependency on erc-bbdb.
221 (erc-nicklist-insert-contents): Tighten some regexps.
222
223 * erc-notify.el (erc-notify-list): Docfix.
224
225 * erc-spelling.el (erc-spelling-dictionaries): Add :type and
226 :group to silence a compiler warning.
227
2282005-08-14 Michael Olson <mwolson@gnu.org>
229
230 * erc-backend.el (erc-session-server, erc-session-port)
231 (erc-announced-server-name, erc-server-version)
232 (erc-server-parameters): Moved here from erc.el.
233 (erc-server-last-peers): Moved, renamed from last-peers.
234 (erc-server-lag): Moved, renamed from erc-lag.
235 (erc-server-duplicates): Moved, renamed from erc-duplicates.
236 (erc-server-duplicate-timeout): Moved, renamed from
237 erc-duplicate-timeout.
238 (erc-server): New customization group hosting all options from
239 this file.
240 (erc-server-prevent-duplicates): Moved, renamed from
241 erc-prevent-duplicates.
242 (erc-server-duplicate-timeout): Moved, renamed from
243 erc-duplicate-timeout.
244 (erc-server-auto-reconnect, erc-split-line-length)
245 (erc-server-coding-system, erc-encoding-coding-alist)
246 (erc-server-connect-function, erc-server-flood-margin)
247 (erc-server-flood-penalty): Change group to 'erc-server.
248 (erc-server-send-ping-interval): Moved, renamed from
249 erc-ping-interval.
250 (erc-server-ping-handler): Moved, renamed from erc-ping-handler.
251 (erc-server-setup-periodical-server-ping): Moved, renamed from
252 erc-setup-periodical-server-ping.
253 (erc-server-connect): Add to docstring. Move more initialization
254 here.
255 (erc-server-processing-p): Docfix.
256 (erc-server-connect): Use 'raw-text like in the original version.
257 (erc-server-filter-function): Don't reset process coding system.
258
259 * erc-stamp.el (erc-add-timestamp): If the text at point is
260 invisible, don't insert a timestamp. Thanks to Pascal
261 J. Bourguignon for the suggestion.
262
263 * erc-match.el (erc-text-matched-hook): Don't hide fools by
264 default, but include it in the available options.
265
2662005-08-13 Michael Olson <mwolson@gnu.org>
267
268 * erc-*.el: s/erc-send-command/erc-server-send/g.
269 s/erc-process/erc-server-process/g (sort of). Occasional
270 whitespace and indentation fixes.
271
272 * erc-backend.el: Specify a few local variables for indentation.
273 Take one item off of the TODO list.
274 (erc-server-filter-data): Renamed from erc-previous-read. From
275 circe.
276 (erc-server-processing-p): New variable that indicates when we're
277 currently processing a message. From circe.
278 (erc-split-line-length): New option that gives the maximum line
279 length of a single message. From circe.
280 (erc-default-coding-system): Moved here from erc.el.
281 (erc-split-line): Renamed from erc-split-command and taken from
282 circe.
283 (erc-connect-function, erc-connect, erc-process-sentinel-1)
284 (erc-process-sentinel, erc-flood-exceeded-p, erc-send-command)
285 (erc-message, erc-upcase-first-word, erc-send-ctcp-message)
286 (erc-send-ctcp-notice): Moved here from erc.el.
287 (erc-server-filter-function): Renamed from erc-process-filter.
288 From circe.
289 (erc-server-process): Renamed from `erc-process' and moved here
290 from erc.el.
291 (erc-server-coding-system): Renamed from
292 `erc-default-coding-system'.
293 (erc-encoding-coding-alist): Moved here from erc.el.
294 (erc-server-flood-margin, erc-server-flood-penalty):
295 (erc-server-flood-last-message, erc-server-flood-queue):
296 (erc-server-flood-timer): New options from circe that allow
297 tweaking of flood control.
298 (erc-server-connect-function): Renamed from erc-connect-function.
299 (erc-flood-exceeded-p): Removed.
300 (erc-coding-system-for-target)
301 (erc-encode-string-for-target, erc-decode-string-from-target):
302 Moved here from erc.el
303 (erc-server-send): Renamed from erc-send-command. Adapted from
304 the circe function by the same name.
305 (erc-server-send-queue): New function from circe that implements
306 handling of a flood queue.
307 (erc-server-current-nick): Renamed from current-nick.
308 (erc-server-quitting): Renamed from `quitting'.
309 (erc-server-last-sent-time): Renamed from `last-sent-time'.
310 (erc-server-last-ping-time): Renamed from `last-ping-time'.
311 (erc-server-lines-sent): Renamed from `lines-sent'.
312 (erc-server-auto-reconnect): Renamed from `erc-auto-reconnect'.
313 (erc-server-coding-system): Docfix.
314 (erc-server-connect): Renamed from `erc-connect'. Require SERVER
315 and PORT parameters. Initialize several variables here. Don't
316 set `erc-insert-marker'. Use a per-server coding system via
317 erc-server-default-encoding.
318
319 * erc.el (erc-version-string): Changed to indicate we are running
320 the `more-backend' branch.
321 (erc-send-single-line): Implement flood control using
322 erc-split-line.
323 (erc-send-input): Move functionality of erc-send-single-line in
324 here.
325 (erc-send-single-line): Assimilated!
326 (erc-display-command, erc-display-msg): Handle display hooks.
327 (erc-auto-reconnect, current-nick, last-sent-time)
328 (last-ping-time, last-ctcp-time, erc-lines-sent, erc-bytes-sent)
329 (quitting): Moved to erc-backend.el.
330 (erc): Docfix. Don't initialize quite so many things here.
331
3322005-08-10 Michael Olson <mwolson@gnu.org>
333
334 * debian/copyright (Copyright): Remove notices for 4 people, since
335 they didn't contribute legally-significant changes, or have had
336 these changes overwritten.
337
338 * erc-log.el: Remove copyright notice.
339
340 * erc.el: Remove 3 copyright notices.
341
3422005-08-09 Michael Olson <mwolson@gnu.org>
343
344 * debian/changelog: Create 5.0.4-3 package. This doesn't serve
345 any purpose other than to thank Romain Francoise for some advice.
346
347 * Makefile (debrelease): Allow last upload and extra build options
348 to be specified.
349
3502005-08-08 Michael Olson <mwolson@gnu.org>
351
352 * debian/changelog: Create 5.0.4-2 package.
353
354 * debian/control (Uploaders): Add Romain Francoise.
355 (Standards-Version): Update to 3.6.2.
356 (Depends): Add `emacsen'.
357
358 * debian/scripts/startup.erc (load-path): Minor whitespace fixup.
359
360 * Makefile (clean): Split target from realclean and make it remove
361 files that aren't packaged in releases.
362 (clean, release): Minor cleanups.
363 (debrelease): Use debuild rather than dpkg-buildpackage since the
364 former calls lintian. Minor cleanups.
365 (debrelease-mwolson): New target that removes old Debian packages,
366 calls debrelease, and copies the resulting package to my dist dir.
367 (upload): New target that automates the process of uploading an
368 ERC release to sourceforge.
369
370 * erc.el (erc-mode): Use `make-local-variable' instead of
371 `make-variable-buffer-local'.
372
3732005-07-12 Michael Olson <mwolson@gnu.org>
374
375 * debian/changelog: Build 5.0.4-1.
376
377 * Makefile (release): Prepare zip file in addition to tarball.
378
379 * NEWS: Add item for the undo fix.
380
3812005-07-09 Michael Olson <mwolson@gnu.org>
382
383 * erc-nicklist.el (erc-nicklist-insert-contents): Check
384 erc-announced-name before erc-session-server. Make sure that we
385 can never get a stringp (nil) error.
386 (erc-nicklist-call-erc-command): If given no command, do nothing.
387 This fixes an error that used to occur when a stray mouse click
388 was made outside of the popup window, but on the erc-nicklist
389 menu.
390
391 * erc-bbdb.el (erc-bbdb-search-name-and-create): Get rid of the
392 infinite input loop when you want to create a new record. Replace
393 most of that with a completing read of existing nicks. If no nick
394 is chosen, create a new John Doe record. The net effect of this
395 is that the old behavior is re-instated, with the addition of one
396 completing read that happens when you do a /whois.
397
3982005-07-09 Johan Bockgård <bojohan@users.sourceforge.net>
399
400 * erc.el (erc-process-input-line): Docfix.
401 (erc-update-mode-line-buffer): Use `erc-propertize' instead of
402 `propertize'.
403 (erc-propertize): Move to erc-compat.el.
404
405 * erc-compat.el (erc-propertize): Move here from erc.el. Always
406 return a copy of the string (like `propertize' in GNU Emacs).
407
408 * erc-nicklist.el (erc-nicklist-icons-directory)
409 (erc-nicklist-voiced-position)
410 (erc-nicklist-insert-medium-name-or-icon): Docfix.
411 (erc-nicklist-insert-contents): Simplify.
412 (erc-nicklist-mode-map): Bind RET instead of `return'. Bind
413 `down-mouse-3' instead of `mouse-3'.
414 (erc-nicklist-kbd-cmd-QUERY): Cleanup regexp.
415 (erc-nicklist-channel-users-info): Docfix. Simplify.
416
4172005-07-02 Michael Olson <mwolson@gnu.org>
418
419 * images: New directory containing the images that are used by
420 erc-nicklist.el. These are from Gaim, and are thought to be
421 available under the terms of the GPL.
422
423 * erc-bbdb.el: Add local variables section to preserve tabs, since
424 that is the style used throughout this file. Apply patch from
425 Edgar Gonçalves as follows.
426 (erc-bbdb-bitlbee-name-field): New variable that indicates the
427 field name to use for annotating the "displayed name" of a bitlbee
428 contact.
429 (erc-bbdb-irc-highlight-field): Docfix.
430 (erc-bbdb-search-name-and-create): Prompt the user for the name of
431 a contact if none was found. Merge the new entries into the
432 specified contact. If new arg SILENT is non-nil, do not prompt
433 the user for a name or offer to merge the new entry.
434 (erc-bbdb-insinuate-and-show-entry): New arg SILENT is accepted,
435 which is passed on to erc-bbdb-search-name-and-create.
436 (erc-bbdb-whois): Tell erc-bbdb-search-name-and-create to prompt
437 for name if necessary.
438 (erc-bbdb-JOIN, erb-bbdb-NICK): Forbid
439 erc-bbdb-search-name-and-create from prompting for a name.
440
441 * erc-nicklist.el: Add local variables section to preserve tabs,
442 since that is the style used throughout this file. Apply patch
443 from Edgar Gonçalves as follows.
444 (erc-nicklist-use-icons): New option; if non-nil, display an icon
445 instead of the name of the chat medium.
446 (erc-nicklist-icons-directory): New option indicating the path to
447 the PNG files that are used for chat icons.
448 (erc-nicklist-use-icons): New option indicating whether to put
449 voiced nicks on top, bottom, or not to differentiate them. The
450 default is to put them on the bottom.
451 (erc-nicklist-bitlbee-connected-p): New variable that indicates
452 whether or not we are currently using bitlbee. An attempt will be
453 made to auto-detect the proper value. This is bound in the
454 `erc-nicklist-insert-contents' function.
455 (erc-nicklist-nicklist-images-alist): New variable that maps a
456 host type to its icon. This is set by `erc-nicklist'.
457 (erc-nicklist-insert-medium-name-or-icon): New function that
458 inserts an icon or string that identifies the current host type.
459 (erc-nicklist-search-for-nick): New function that attempts to find
460 a BBDB record that corresponds with this contact given its
461 finger-host. If found, return its bitlbee-nick field.
462 (erc-nicklist-insert-contents): New function that inserts the
463 contents of the nick list, including text properties and images.
464 (erc-nicklist): Populate `erc-nicklist-images-alist'. Move
465 nicklist content generation code to
466 `erc-nicklist-insert-contents'.
467 (erc-nicklist-mode-map): Map C-j to erc-nicklist-kbd-menu and RET
468 to erc-nicklist-kbd-cmd-QUERY.
469 (erc-nicklist-call-erc-command): Make use of
470 `switch-to-buffer-other-window'.
471 (erc-nicklist-cmd-QUERY): New function that opens a query buffer
472 for the given contact.
473 (erc-nicklist-kbd-cmd-QUERY): Ditto; contains most of the code.
474 (erc-nicklist-kbd-menu): New function that shows the nicklist
475 action menu.
476 (erc-nicklist-channel-users-info): Renamed from
477 `erc-nicklist-channel-nicks'. Implement sorting voiced users.
478
4792005-06-29 Johan Bockgård <bojohan+sf@dd.chalmers.se>
480
481 * erc-nickserv.el (erc-nickserv-alist): Fix regexp for Azzurra.
482
4832005-06-26 Michael Olson <mwolson@gnu.org>
484
485 * erc-autojoin.el (erc-autojoin-add, erc-autojoin-remove): Use
486 `erc-session-server' if `erc-announced-server-name' is nil. This
487 happens when servers don't send a 004 message.
488
489 * erc.el (erc-quit-server): Ditto.
490
491 * erc-ibuffer.el (erc-server, erc-server-name): Ditto.
492
493 * erc-notify.el (erc-notify-JOIN, erc-notify-NICK)
494 (erc-notify-QUIT): Ditto.
495
4962005-06-24 Johan Bockgård <bojohan+sf@dd.chalmers.se>
497
498 * erc.el (erc-default-coding-system)
499 (erc-handle-user-status-change): Docstring fix.
500 (with-erc-channel-buffer): Removed.
501 (erc-ignored-reply-p): Replace `with-erc-channel-buffer' with
502 `erc-with-buffer'.
503 (erc-display-line-1): Fix broken undo.
504
5052005-06-23 Michael Olson <mwolson@gnu.org>
506
507 * CREDITS: Add entries for Luigi Panzeri and Andreas Schwab.
508
509 * erc-nickserv.el (erc-nickserv-alist): Add entries for Azzurra
510 and OFTC. Thanks to Luigi Panzeri and Andreas Schwab for
511 providing these.
512
5132005-06-16 Michael Olson <mwolson@gnu.org>
514
515 * CREDITS: Add John Paul Wallington.
516
517 * erc.el: Thanks to John Paul Wallington for the following.
518 (erc-nickname-in-use): Use `string-to-number' instead of
519 `string-to-int'.
520
521 * erc-dcc.el (erc-dcc-handle-ctcp-send)
522 (erc-dcc-handle-ctcp-chat, erc-dcc-get-file)
523 (erc-dcc-chat-accept): Ditto.
524
525 * erc-identd.el (erc-identd-start): Ditto.
526
5272005-06-16 Johan Bockgård <bojohan+sf@dd.chalmers.se>
528
529 * erc.el (erc-mode-map): Suppress `font-lock-fontify-block' key
530 binding since it destroys face properties.
531
5322005-06-08 Michael Olson <mwolson@gnu.org>
533
534 * erc.el (erc-cmd-UNIGNORE): Use `erc-member-ignore-case' instead
535 of `member-ignore-case'. Thanks to bpalmer for the heads up.
536
5372005-06-06 Michael Olson <mwolson@gnu.org>
538
539 * erc.el (erc-modules): Fix a mistake I made when editing this a
540 few days ago. Modes should now be disabled properly.
541 (erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Remove unnecessary call to
542 `format'. Thanks to Andreas Schwab for reporting this.
543
544 * debian/changelog: Close "README file missing" bug.
545
546 * debian/rules (binary-erc): Install README file.
547
5482005-06-03 Michael Olson <mwolson@gnu.org>
549
550 * erc.el (erc-with-buffer): Set `lisp-indent-function' so Emacs
551 Lisp mode knows how to indent erc-with-buffer blocks.
552 (with-erc-channel-buffer): Ditto.
553 (erc-with-all-buffers-of-server): Ditto.
554 (erc-modules): Use pcomplete by default, not completion, since
555 erc-complete.el is deprecated. Use `fboundp' instead of
556 `symbol-value' to check for existence of a function before calling
557 it. This was causing an error when untoggling the `completion'
558 option and trying to save via the customize interface.
559
560 * erc-track.el (erc-modified-channels-update): If a buffer is not
561 currently connected, remove it from the modified channels list.
562 This should fix the problem where residue was left on the mode
563 line after quitting ERC.
564
565 * erc-list.el (erc-prettify-channel-list): Docfix; thanks to John
566 Paul Wallington for reporting this.
567
5682005-05-31 Michael Olson <mwolson@gnu.org>
569
570 * debian/changelog: First draft of entries for the 5.0.3 release.
571
572 * debian/README.Debian: Note that ERC will now install correctly
573 on versions of Emacs or XEmacs that do not have the `format-spec'
574 library. Correct some grammar and prune the content a bit.
575
576 * debian/scripts/install (emacs20): Remove line since we no longer
577 need to deal with format-spec.el.
578
579 * NEWS: Add entries for the upcoming 5.0.3 release.
580
581 * erc.el: Don't require format-spec since this is provided in
582 erc-compat.el now.
583 (erc-process-sentinel, erc-setup-periodical-server-ping): Use
584 `erc-cancel-timer' instead of `cancel-timer'.
585 (erc-version-string): Update to 5.0.3.
586
587 * erc-autoaway.el (autoaway, erc-autoaway-reestablish-idletimer):
588 Use `erc-cancel-timer' instead of `cancel-timer'.
589
590 * erc-compat.el (format-spec, format-spec-make): If we cannot load
591 the `format-spec' library, provide versions of these functions.
592 This should keep problems from surfacing with Emacs21 Debian
593 builds.
594 (erc-cancel-timer): New function created to take the place of
595 `cancel-timer' since XEmacs calls it something else.
596
597 * erc-track.el (erc-modified-channels-update): Accept any number
598 of arguments, which are ignored. This allows it to be run from
599 `erc-disconnected-hook' without extra bother.
600 (track): Add `erc-modified-channels-update' to
601 `erc-disconnected-hook' so that the indicators are removed
602 correctly in some edge cases.
603 (erc-modified-channels-display): Make sure that we never pass nil
604 to the function in `erc-track-shorten-function'. This happens
605 when we have deleted buffers in `erc-modified-channels-alist'.
606 Also, make sure that the buffer has a non-nil short-name before
607 adding it to the string list. This should fix some XEmacs
608 warnings when running /quit with unchecked buffers, as well as get
609 rid of a stray buffer problem (or so it is hoped).
610
6112005-05-31 Johan Bockgård <bojohan+sf@dd.chalmers.se>
612
613 * erc-replace.el, erc-speak.el: Clean up comment formatting.
614
615 * erc-ring.el (ring, erc-input-ring-index, erc-clear-input-ring):
616 Clean up docstring formatting.
617
6182005-05-30 Johan Bockgård <bojohan+sf@dd.chalmers.se>
619
620 * erc.el (erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Delete superfluous
621 arg to `format'.
622 (erc-load-irc-script): Use `insert-file-contents' instead of
623 `insert-file'. Simplify.
624
6252005-05-29 Michael Olson <mwolson@gnu.org>
626
627 * erc.el (erc-version-string): Move this up so that it is
628 evaluated before the `require' statements. Not a major change.
629
6302005-04-27 Johan Bockgård <bojohan+sf@dd.chalmers.se>
631
632 * erc.el (erc-complete-word): Simplify.
633
6342005-04-27 Michael Olson <mwolson@gnu.org>
635
636 * Makefile (debrelease): Use a slightly different approach when
637 removing CVS and Arch cruft.
638
639 * debian/changelog: Update for 5.0.2-1 package.
640
6412005-04-25 Michael Olson <mwolson@gnu.org>
642
643 * erc-autoaway.el (erc-autoaway-reestablish-idletimer): Move code
644 block higher in file to fix a load failure when using Emacs21.
645 Thanks to Daniel Brockman for the report and fix.
646
6472005-04-24 Adrian Aichner <adrian@xemacs.org>
648
649 * erc-backend.el (JOIN): save-excursion so that
650 `erc-current-logfile' inserts into the correct channel buffers
651 when using erc-log-insert-log-on-open in combination with autojoin
652 to multiple channels.
653
6542005-04-17 Adrian Aichner <adrian@xemacs.org>
655
656 * erc-log.el: Remove stray whitespace.
657 * erc.el: Ditto.
658
6592005-04-09 Aidan Kehoe <kehoea@parhasard.net>
660
661 * erc.el: autoload erc-select-read-args, which, because it parses
662 erc-select's args, can be called before erc.el is loaded.
663
6642005-04-07 Edward O'Connor <ted@oconnor.cx>
665
666 * erc-viper.el: Remove final newlines from previously-existing ERC
667 buffers. (Minor bug fix.)
668
6692005-04-06 Michael Olson <mwolson@gnu.org>
670
671 * Makefile (debrelease): Ignore errors from deleting Arch and CVS
672 metadata.
673
6742005-04-05 Michael Olson <mwolson@gnu.org>
675
676 * ChangeLog, CREDITS, AUTHORS: Correct name and email address of
677 Marcelo Toledo.
678
6792005-04-04 Michael Olson <mwolson@gnu.org>
680
681 * erc.el (erc-modules): Add entry for spelling module.
682
683 * erc-spelling.el: Add autoload line.
684
685 * erc-backend.el: Apply latest non-ascii patch from Kai Fan.
686 (erc-decode-parsed-server-response): Search
687 erc-response.command-args for channel name. Decode the
688 erc-response struct using this channel name as key according to
689 the `erc-encoding-coding-alist'.
690
691 * erc-track.el: Apply patch from Henrik Enberg.
692 (erc-modified-channels-object): Use optimal amount of whitespace
693 around modified channels indicator.
694
6952005-04-02 Johan Bockgård <bojohan+sf@dd.chalmers.se>
696
697 * erc.el (define-erc-module, erc-with-buffer)
698 (erc-with-all-buffers-of-server, with-erc-channel-buffer): Add
699 edebug-form-spec.
700
701 * erc-compat (erc-define-minor-mode): Ditto.
702
7032005-03-29 Jorgen Schaefer <forcer@forcix.cx>
704
705 * erc-spelling.el: New file.
706
7072005-03-24 Johan Bockgård <bojohan+sf@dd.chalmers.se>
708
709 * erc-backend.el (define-erc-response-handler): Add
710 `definition-name' property to constructed symbols so that
711 find-function and find-variable will find them.
712
7132005-03-21 Michael Olson <mwolson@gnu.org>
714
715 * erc-dcc.el, erc-goodies.el, erc-list.el, erc-notify.el,
716 erc-ring.el, erc.el: Copyright assignment occurred.
717
718 * debian/scripts/install: Make a shell wrapper around the original
719 Makefile and inline the Makefile. The problem is that Debian
720 passes all the Emacs variants at once, rotating them at every
721 invocation of the install script, which happens once per variant.
722 This caused each installation to happen N-1 times more often than
723 it should have. As a result, we need to only deal with the first
724 argument.
725 (ELFILES): Only add format-spec.el if we are compiling for
726 emacs21. Don't filter out erc-compat.el.
727 (SITEFLAG): New variable that indicates that the "nosite" option
728 should look like.
729 (.DEFAULT): Use $(FLAVOUR) instead of $@ for clarity.
730
731 * debian/rules: Install NEWS file and compress it.
732
733 * debian/maint/postinst: Be more cautious about configuration
734 step.
735
736 * debian/copyright (Copyright): Another assignment came in.
737
738 * debian/control (Standards-Version): Update to a newer version as
739 recommended by lintian.
740
741 * debian/changelog: Changes made for the Debian package.
742
743 * debian/README.Debian: Keep only the General Notes section.
744
745 * NEWS: Move old history items here from debian/README.Debian.
746
747 * Makefile (SNAPSHOTDATE): Deprecate this option since we hope to
748 release more often.
749
7502005-03-20 Jorgen Schaefer <forcer@users.sourceforge.net>
751
752 * erc.el (erc-define-catalog, `ctcp-request-to'): Fix typo (%: ->
753 %t:).
754
7552005-03-01 Michael Olson <mwolson@gnu.org>
756
757 * erc-log.el (erc-save-buffer-in-logs): Replace tabs with spaces
758 in code indentation.
759
7602005-02-28 Michael Olson <mwolson@gnu.org>
761
762 * erc.el (erc-display-message): Apply corrected patch from Henrik
763 Enberg.
764
7652005-02-27 Michael Olson <mwolson@gnu.org>
766
767 * erc.el (erc-display-message): Apply patch from Henrik Enberg.
768 Check here to see if a message should be hidden, rather than
769 relying on code in each individual command.
770 (erc-version-string): Add "(CVS)" to the version string for
771 clarity.
772
773 * erc-backend.el (JOIN, KICK, MODE, NICK, PART, QUIT, TOPIC):
774 Don't check `erc-hide-list' here.
775
776 * erc-list.el, erc-match.el, erc.el, debian/copyright: Update
777 copyright information as a few more people have assignments
778 registered.
779
7802005-02-06 Michael Olson <mwolson@gnu.org>
781
782 * erc-backend.el: Apply patch from Kai Fan for non-ASCII character
783 support.
784 (erc-parse-server-response): Add call to
785 `erc-decode-parsed-server-response'.
786 (erc-decode-parsed-server-response): New function that decodes a
787 pre-parsed server response before it can be handled.
788 (PRIVMSG): Comment out call to `erc-decode-string-from-target'.
789 (TOPIC): Ditto.
790
7912005-02-01 Jorgen Schaefer <forcer@users.sourceforge.net>
792
793 * erc.el (erc-process-sentinel-1): Don't reconnect on connection
794 refused. This error is reported differently when using
795 open-network-stream-nowait.
796
7972005-01-26 Diane Murray <disumu@x3y2z1.net>
798
799 * erc.el (erc-cmd-APPENDTOPIC, erc-set-topic): The control
800 character in `channel-topic' was changed to \C-o - replaced \C-c
801 with \C-o so that these functions work as expected again.
802 (erc-get-channel-mode-from-keypress): Doc fix.
803
8042005-01-25 Diane Murray <disumu@x3y2z1.net>
805
806 * erc.el, erc-button.el, erc-compat.el, erc-goodies.el,
807 erc-match.el, erc-nets.el, ChangeLog, NEWS: Merged bug fixes made
808 on release_5_0_branch since 5.0.1 release.
809
8102005-01-24 Johan Bockgård <bojohan+sf@dd.chalmers.se>
811
812 * erc.el (erc-input-action): Quote `erc-action-history-list' so
813 that input history actually works.
814 (erc-process-ctcp-query): Fix and simplify logic.
815 (erc-get-channel-mode-from-keypress): Use `C-' string syntax.
816 (erc-load-irc-script-lines): Use `erc-command-indicator' instead
817 of `erc-prompt'.
818
8192005-01-23 Edward O'Connor <ted@oconnor.cx>
820
821 * erc-viper.el: Ensure that `viper-comint-mode-hook' runs in
822 buffers whose `erc-mode-hook' has already run when this file is
823 loaded.
824 Explicitly `require' erc.el.
825
8262005-01-22 Edward O'Connor <ted@oconnor.cx>
827
828 * erc.el (erc-mode): Remove frobbing of `require-final-newline'.
829
830 * erc-log.el (erc-save-buffer-in-logs): Remove frobbing of
831 `require-final-newline'.
832
833 * erc-viper.el: New file. This is where all ERC/Viper
834 compatiibilty code should live. When and if ERC is bundled with
835 Emacs, some of the hacks in this file should be merged into Viper
836 itself.
837
8382005-01-21 Edward O'Connor <ted@oconnor.cx>
839
840 * erc.el (erc-mode): Set `require-final-newline' to nil in ERC
841 buffers. This prevents a Viper misfeature whereby extraneous
842 newlines are inserted into the ERC buffer when switching between
843 viper states.
844
845 * erc-log.el (erc-save-buffer-in-logs): Bind `require-final-newline'
846 to t when calling `write-region' to ensure that further log
847 entries start on fresh lines.
848
8492005-01-21 Diane Murray <disumu@x3y2z1.net>
850
851 * erc-button.el (erc-button-add-face): Reverted my change to the
852 order faces since it had the unwanted effect of putting the button
853 face after all others.
854 (erc-button-face-has-priority): Removed this variable as it is not
855 necessary anymore - it was used to compensate for the above
856 mentioned change.
857
858 * NEWS: Added the latest fixes.
859
8602005-01-20 Diane Murray <disumu@x3y2z1.net>
861
862 * erc-button.el, erc-match.el:
863 (erc-button-syntax-table, erc-match-syntax-table): Added \ as a
864 legal character for nicknames.
865
866 * erc-nets.el (erc-server-select): Fixed so that only networks
867 with servers found in `erc-server-alist' are available as choices.
868
869 * erc.el, erc-compat.el, erc-goodies.el:
870 (erc-replace-match-subexpression-in-string): New function. Needed
871 because `replace-match' in XEmacs doesn't replace regular
872 expression subexpressions in strings, only in buffers.
873 (erc-seconds-to-string, erc-controls-interpret): Use the new
874 function.
875
876 * erc-button.el (erc-button-add-button): Use the `:button-face'
877 key combined with an `erc-mode' local `widget-button-face' set to
878 nil to get the widget overlay face suppressed in XEmacs.
879
8802005-01-19 Francis Litterio <franl@world.std.com>
881
882 * erc-button.el (erc-button-add-face): The face added by this
883 function is more important than the existing text's face, so we
884 now prepend erc-button-face to the list of existing faces when
885 adding a button. To instead append erc-button-face to existing
886 faces, set variable `erc-button-face-has-priority' to nil.
887 (erc-button-face-has-priority): New variable to control how
888 erc-button-add-face adds erc-button-face to existing faces.
889 (erc-button-press-button): Silenced a byte-compiler warning about
890 too few arguments in a call to `error'.
891
8922005-01-19 Diane Murray <disumu@x3y2z1.net>
893
894 * NEWS: Added list of 5.0.1 fixes.
895
8962005-01-19 Michael Olson <mwolson@gnu.org>
897
898 * AUTHORS: Move to format that cscvs can understand. As an added
899 perk, entries line up nicer.
900
901 * erc.el, erc-fill.el, erc-pcomplete.el, debian/copyright: Merge a
902 few more copyright lines thanks to Alex Schroeder's BBDB file.
903
904 * Makefile: Change version to correspond with our new scheme.
905
9062005-01-18 Diane Murray <disumu@x3y2z1.net>
907
908 * erc-list.el (erc-chanlist-channel-line-regexp): Now matches
909 private channels, the channels `#' and `&', and channels with
910 names including non-ascii characters.
911 (erc-chanlist-join-channel): Don't attempt to join private
912 channels since the channel name is unknown.
913
914 * erc-goodies.el (erc-make-read-only): Add `rear-nonsticky'
915 property to avoid `Text is read-only' errors during connection.
916 `front-nonsticky' does not exist, changed to `front-sticky'.
917 (erc-controls-interpret, erc-controls-strip): Just work on the
918 string, don't open a temporary buffer.
919 (erc-controls-propertize): Now accepts optional argument STR.
920
9212005-01-17 Michael Olson <mwolson@gnu.org>
922
923 * Makefile: Version is 5.01, but only in the Makefile. It has not
924 been released yet.
925
926 * erc-auto.in, erc-autojoin.el, erc-bbdb.el, erc-button.el,
927 erc-chess.el, erc-complete.el, erc-dcc.el, erc-fill.el,
928 erc-goodies.el, erc-ibuffer.el, erc-identd.el, erc-imenu.el,
929 erc-list.el, erc-match.el, erc-menu.el, erc-nets.el,
930 erc-netsplit.el, erc-nickserv.el, erc-notify.el, erc-pcomplete.el,
931 erc-ring.el, erc-speak.el, erc-speedbar.el, erc-stamp.el,
932 erc-track.el, erc-xdcc.el, erc.el, debian/copyright: Update
933 copyright notices. If anyone has signed papers for Emacs in
934 general, merge them with the FSF's entry.
935
9362005-01-16 Diane Murray <disumu@x3y2z1.net>
937
938 * erc.el (erc): `erc-set-active-buffer' was being called before
939 `erc-process' was set, so that channels weren't being marked
940 active correctly upon join; fixed.
941
9422005-01-15 Johan Bockgård <bojohan+sf@dd.chalmers.se>
943
944 * erc-backend.el (def-edebug-spec): This macro caused problems (in
945 XEmacs). Use its expansion directly.
946
9472005-01-15 Diane Murray <disumu@x3y2z1.net>
948
949 * erc-button.el (erc-button-add-button): Reverted previous change
950 since `:suppress-face' doesn't seem to be checked for a certain
951 face.
952 (erc-button-add-face): FACE is now appended to the `old' face.
953 This should fix the problem of faces being "covered" by
954 `erc-button-face'.
955
9562005-01-14 Diane Murray <disumu@x3y2z1.net>
957
958 * erc.el, erc-backend.el (erc-cmd-OPS, erc-cmd-COUNTRY,
959 erc-cmd-NICK, erc-process-ctcp-query, ERROR, PONG, 311, 312, 313,
960 314, 317, 319, 320, 321, 322, 330, 352): Use catalog entries
961 instead of hard-coded text messages.
962 (english): Added new catalog entries `country', `country-unknown',
963 `ctcp-empty', `ctcp-request-to', `ctcp-too-many', `nick-too-long',
964 `ops', `ops-none', `ERROR', `PONG', `s311', `s312', `s313',
965 `s314', `s317', `s317-on-since', `s319', `s320', `s321', `s322',
966 `s330', and `s352'.
967 (erc-send-current-line): Use `erc-set-active-buffer' (change was
968 lost in previous bug fix).
969
9702005-01-14 Francis Litterio <franl@world.std.com>
971
972 * erc-button.el (erc-button-add-button): Fixed a bug where the
973 overlay created by widget-convert-button has a `face' property
974 that hides the `face' property set on the underlying button text.
975
976 * erc-goodies.el: Docstring fix.
977
978 * erc-button.el: Improved docstring for variable erc-button-face.
979
9802005-01-13 Diane Murray <disumu@x3y2z1.net>
981
982 * erc-menu.el (erc-menu-definition): "Topic set by channel
983 operator": Small word change. "Identify to NickServ...": Check
984 that we're connected to the server. Added "Save buffer in log"
985 and "Truncate buffer".
986
9872005-01-13 Lawrence Mitchell <wence@gmx.li>
988
989 * erc.el (erc-display-line-1): Widen before we try to insert
990 anything, this makes sure input isn't broken when the buffer is
991 narrowed by the user.
992 (erc-beg-of-input-line): Simplify, just return the position of
993 `erc-insert-marker' or error if does not exist.
994 (erc-send-current-line): Widen before trying to send anything.
995
9962005-01-13 Diane Murray <disumu@x3y2z1.net>
997
998 * erc.el, erc-backend.el, erc-list.el:
999 (erc-update-mode-line-buffer): Strip controls characters from
1000 `channel-topic' since we add our own control character to it.
1001 (TOPIC, 332): Use \C-o instead of \C-c to force an end of IRC
1002 control characters as it also ends bold, underline, and inverse -
1003 \C-c only ends colors.
1004 (erc-chanlist-322): Strip control characters from channel and
1005 topic. No need to interpret controls when we're applying overlays
1006 to the lines.
1007
1008 * erc.el, erc-backend.el, erc-button.el, erc-netsplit.el,
1009 erc-nicklist.el: Fixed so that each server has an active buffer.
1010 (erc-active-buffer): Now a buffer-local variable.
1011 (erc-active-buffer, erc-set-active-buffer): New functions.
1012 (erc-display-line, erc-echo-notice-in-active-non-server-buffer,
1013 erc-process-away, MODE): Call `erc-active-buffer' to get the
1014 active buffer for the current server.
1015 (erc, erc-process-sentinel-1, erc-grab-region, erc-input-action,
1016 erc-send-current-line, erc-invite-only-mode,
1017 erc-toggle-channel-mode, erc-channel-names, MODE, erc-nick-popup,
1018 erc-nicklist-call-erc-command): Use `erc-set-active-buffer' to set
1019 the active buffer for the current server.
1020 (erc-cmd-WHOLEFT): Use 'active as BUFFER in `erc-display-message'.
1021
1022 * erc-track.el (erc-track-modified-channels): Server buffers are
1023 now treated the same as channels and queries. This means that
1024 `erc-track-priority-faces-only', `erc-track-exclude', and
1025 `erc-track-exclude-types' now work with server buffers.
1026
10272005-01-12 Diane Murray <disumu@x3y2z1.net>
1028
1029 * erc-backend.el (475): Prompt for the channel's key if
1030 `erc-prompt-for-channel-key' is non-nil. Send a new JOIN message
1031 with the key if a key is provided.
1032
1033 * erc.el (erc-command-indicator): Fixed customization choices so
1034 that there's no `mismatch' message when nil is the value.
1035
10362005-01-11 Michael Olson <mwolson@gnu.org>
1037
1038 * erc-bbdb.el (bbdb): Lowercase the name of the module. This
1039 fixes a bug which caused an error to occur when trying to enable
1040 the module using the customization interface.
1041
10422005-01-08 Edward O'Connor <ted@oconnor.cx>
1043
1044 * erc-track.el: Support using faces to indicate channel activity
1045 in the modeline under XEmacs.
1046 (erc-modified-channels-object): New function.
1047 (erc-modified-channels-display): Use it.
1048 `erc-modified-channels-string' renamed to
1049 `erc-modified-channels-object' (because it's no longer a string on
1050 XEmacs). The new function `erc-modified-channels-object' is used
1051 to generate updated values for the same-named variable.
1052
10532005-01-08 Diane Murray <disumu@x3y2z1.net>
1054
1055 * ChangeLog.2002: Changed instances of my sourceforge username and
1056 email address to real name and email.
1057
1058 * erc.el (erc-modules): Changed customization tag descriptions, so
1059 that they all start with a verb; added new modules to choices.
1060
10612005-01-08 Mario Lang <mlang@delysid.org>
1062
1063 * debian/rules: Introduce new variable DOCDIR to simplify stuff a
1064 bit.
1065
10662005-01-08 Michael Olson <mwolson@gnu.org>
1067
1068 * AUTHORS, ChangeLog.2004: Change bpalmer's email address as
1069 requested.
1070
1071 * CREDITS: Add everyone who is mentioned in the ChangeLogs.
1072
1073 * debian/copyright (Copyright): Add last few people. This can now
1074 be considered a complete list, as far as CVS entries are
1075 concerned. If people have assigned copyright to the FSF, merge
1076 them with the entry for the FSF.
1077
1078 * debian/README.Debian: Add entry for XEmacs-related change in
1079 `erc-track.el'.
1080
1081 * erc.el (erc-cmd-MODE): New command that changes or displays the
1082 mode for a channel or user. The functionality was present before
1083 this change, but there was no documentation for it.
1084
1085 * erc-auto.in, erc-*.el: Fully investigate copyright headers and
1086 change them appropriately. If a file has been pulled off of
1087 erc.el at one time, keep track of copyright from the time of
1088 separation, but not before. If a file has been derived from a
1089 work outside of erc, keep copyright statements in place.
1090
1091 * Makefile (VERSION): Change to 5.0! :^) Congrats on all the great
1092 work. I'll wait until hober commits his XEmacs compatibility
1093 patch to erc-track.el, and then release.
1094 (distclean): Alias for `realclean' target.
1095
10962005-01-07 Michael Olson <mwolson@gnu.org>
1097
1098 * AUTHORS: Add Marcelo Toledo, who has CVS access to this project.
1099
1100 * ChangeLog.2004: Add my name to my one contribution to erc last
1101 year.
1102
1103 * CREDITS: Add people that were discovered while scouring
1104 ChangeLogs.
1105
1106 * debian/copyright: Add everyone from `AUTHORS' to Upstream
1107 Authors. Anyone who has contributed 15 or more lines of
1108 code (according to ChangeLogs) is listed in Copyright section.
1109 Accurate years are included.
1110
1111 * debian/README.Debian: Paste content of NEWS and reformat
1112 slightly.
1113
1114 * debian/rules: Concatenate the ChangeLogs during the Debian
1115 install process and then gzip them.
1116
1117 * Makefile (MISC): Add ChangeLog.yyyy files to list.
1118 (ChangeLog): Remove rule since we do not dynamically generate the
1119 ChangeLog anymore.
1120
1121 * MkChangeLog: Removed since we do not use it to generate the
1122 ChangeLog anymore. cvs2cl does a much better job anyway.
1123
1124 * NEWS: Use 3rd level heading instead of bullets for lists that
1125 contain descriptions.
1126
11272005-01-07 Diane Murray <disumu@x3y2z1.net>
1128
1129 * erc-list.el: Require 'sort.
1130 (erc-chanlist): Disable undo in the channel list buffer.
1131
1132 * erc.el, erc-menu.el: The `IRC' menu is now automatically added
1133 to the menu-bar. Add the call to `easy-menu-add' to
1134 `erc-mode-hook' when running in XEmacs (without this the menu
1135 doesn't appear).
1136
1137 * NEWS: Added the information from
1138 http://emacswiki.org/cgi-bin/wiki/ErcCvsFeatures and the newer
1139 changes which weren't yet documented on that page.
1140
11412005-01-06 Hoan Ton-That <hoan@ton-that.org>
1142
1143 * erc-log.el (erc-current-logfile): Only downcase the logfile
1144 name, not the whole filename. Also expand relative to
1145 `erc-log-channels-directory'.
1146 (erc-generate-log-file-name-with-date)
1147 (erc-generate-log-file-name-short)
1148 (erc-generate-log-file-name-long): Don't expand filename, done in
1149 `erc-current-logfile'.
1150
11512005-01-06 Lawrence Mitchell <wence@gmx.li>
1152
1153 * NEWS: New file, details user visible changes from version to
1154 version.
1155
1156 * HACKING (NEWS entries): Mention NEWS file, and what its purpose
1157 is.
1158
11592005-01-05 Michael Olson <mwolson@gnu.org>
1160
1161 * FOR-RELEASE: New file containing the list of release-critical
1162 tasks. Feel free to add to it.
1163
1164 * debian/rules (binary-erc): Add ChangeLog files.
1165
11662005-01-04 Michael Olson <mwolson@gnu.org>
1167
1168 * ChangeLog.2001, ChangeLog.2002, ChangeLog.2003, ChangeLog.2004:
1169 ChangeLog entries from previous years.
1170
1171 * ChangeLog: New file containing ChangeLog entries for the current
1172 year. Please update this file manually whenever a change is
1173 committed. This is a new policy.
1174
1175 * AUTHORS: Add myself to list. Some entries were space-delimited
1176 instead of TAB-delimited, and since the latter seemed to be the
1177 default, make the other entries conform.
1178
1179 * HACKING (ChangeLog Entries): Update section to reflect new
1180 policy toward ChangeLog entries, which is that they should be
1181 manually updated whenever a change is committed.
1182
11832005-01-04 Diane Murray <disumu@x3y2z1.net>
1184
1185 * erc.el (erc-connection-established, erc-login): Update the
1186 mode-line.
1187 (erc-update-mode-line-buffer): If `erc-current-nick' returns nil,
1188 use an empty string for ?n character in format spec. Set
1189 `mode-line-process' to ":connecting" while the connection is being
1190 established.
1191
11922005-01-04 Lawrence Mitchell <wence@gmx.li>
1193
1194 * AUTHORS: Update list of authors.
1195
11962005-01-02 Diane Murray <disumu@x3y2z1.net>
1197
1198 * erc-goodies.el (erc-control-characters): New customization
1199 group.
1200 (erc-interpret-controls-p): Small fix, addition to
1201 documentation. Updated customization to allow 'remove as a value.
1202 Use 'erc-control-characters as `:group'.
1203 (erc-interpret-mirc-color): Use 'erc-control-characters as
1204 `:group'.
1205 (erc-beep-p): Updated documentation. Use 'erc-control-characters
1206 as `:group'.
1207 (define-erc-module irccontrols): Add `erc-controls-highlight' to
1208 `erc-insert-modify-hook' and `erc-send-modify-hook' since it
1209 changes the text's appearance.
1210 (erc-controls-remove-regexp, erc-controls-interpret-regexp): New
1211 variables.
1212 (erc-controls-highlight): Fixed so that highlighting works even if
1213 there is no following control character. Fixed mirc color
1214 highlighting; now respecting `erc-interpret-mirc-color'. Fixed a
1215 bug where emacs would get stuck in a loop when \C-g was in a
1216 message and `erc-beep-p' was set to nil (default setting).
1217
1218 Copyright (C) 2005 Free Software Foundation, Inc.
1219 Copying and distribution of this file, with or without modification,
1220 are permitted provided the copyright notice and this notice are preserved.
1221
1222;; arch-tag: 70f1733a-3e2f-43c2-91c3-d9ace93f82ba
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
new file mode 100644
index 00000000000..41c16b82cb1
--- /dev/null
+++ b/lisp/erc/erc-autoaway.el
@@ -0,0 +1,207 @@
1;;; erc-autoaway.el --- Provides autoaway for ERC
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Jorgen Schaefer <forcer@forcix.cx>
6;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoAway
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; TODO:
28;; - Legacy names: erc-auto-discard-away, erc-auto-set-away
29
30;;; Code:
31
32(require 'erc)
33
34(defgroup erc-autoaway nil
35 "Set yourself automatically away after some idletime and set
36yourself back when you type something."
37 :group 'erc)
38
39(defvar erc-autoaway-idletimer nil
40 "The Emacs idletimer.
41This is only used when `erc-autoaway-use-emacs-idle' is non-nil.")
42
43(defcustom erc-autoaway-use-emacs-idle nil
44 "*If non-nil, the idle time refers to idletime in Emacs.
45If nil, the idle time refers to idletime on IRC only.
46The time itself is specified by `erc-autoaway-idle-seconds'.
47See `erc-autoaway-mode' for more information on the various
48definitions of being idle.
49
50Note that using Emacs idletime is currently broken for most versions,
51since process activity (as happens all the time on IRC) makes Emacs
52non-idle. Emacs idle-time and user idle-time are just not the same."
53 :group 'erc-autoaway
54 :type 'boolean)
55
56;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
57(define-erc-module autoaway nil
58 "In ERC autoaway mode, you can be set away automatically.
59If `erc-auto-set-away' is set, then you will be set away after
60the number of seconds specified in `erc-autoaway-idle-seconds'.
61
62There are several kinds of being idle:
63
64IRC idle time measures how long since you last sent something (see
65`erc-autoaway-last-sent-time'). This is the default.
66
67Emacs idle time measures how long Emacs has been idle. This is
68currently not useful, since Emacs is non-idle when it handles
69ping-pong with IRC servers. See `erc-autoaway-use-emacs-idle' for
70more information.
71
72User idle time measures how long you have not been sending any
73commands to Emacs, or to your system. Emacs currently provides no way
74to measure user idle time.
75
76If `erc-auto-discard-away' is set, then typing anything, will
77set you no longer away.
78
79Related variables: `erc-public-away-p' and `erc-away-nickname'."
80 ;; Enable:
81 ((add-hook 'erc-send-completed-hook 'erc-autoaway-reset-idletime)
82 (add-hook 'erc-server-001-functions 'erc-autoaway-reset-idletime)
83 (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)
84 (when erc-autoaway-use-emacs-idle
85 (erc-autoaway-reestablish-idletimer)))
86 ;; Disable:
87 ((remove-hook 'erc-send-completed-hook 'erc-autoaway-reset-idletime)
88 (remove-hook 'erc-server-001-functions 'erc-autoaway-reset-idletime)
89 (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)
90 (when erc-autoaway-idletimer
91 (erc-cancel-timer erc-autoaway-idletimer)
92 (setq erc-autoaway-idletimer nil))))
93
94(defcustom erc-auto-set-away t
95 "*If non-nil, set away after `erc-autoaway-idle-seconds' seconds of idling.
96ERC autoaway mode can set you away when you idle, and set you no
97longer away when you type something. This variable controls whether
98you will be set away when you idle. See `erc-auto-discard-away' for
99the other half."
100 :group 'erc-autoaway
101 :type 'boolean)
102
103(defcustom erc-auto-discard-away t
104 "*If non-nil, sending anything when away automatically discards away state.
105ERC autoaway mode can set you away when you idle, and set you no
106longer away when you type something. This variable controls whether
107you will be set no longer away when you type something. See
108`erc-auto-set-away' for the other half.
109See also `erc-autoaway-no-auto-discard-regexp'."
110 :group 'erc-autoaway
111 :type 'boolean)
112
113(defcustom erc-autoaway-no-auto-discard-regexp "^/g?away.*$"
114 "*Input that matches this will not automatically discard away status.
115See `erc-auto-discard-away'."
116 :group 'erc-autoaway
117 :type 'regexp)
118
119(eval-when-compile (defvar erc-autoaway-idle-seconds))
120
121(defun erc-autoaway-reestablish-idletimer ()
122 "Reestablish the emacs idletimer.
123You have to call this function each time you change
124`erc-autoaway-idle-seconds', if `erc-autoaway-use-emacs-idle' is set."
125 (interactive)
126 (when erc-autoaway-idletimer
127 (erc-cancel-timer erc-autoaway-idletimer))
128 (setq erc-autoaway-idletimer
129 (run-with-idle-timer erc-autoaway-idle-seconds
130 t
131 'erc-autoaway-set-away
132 erc-autoaway-idle-seconds)))
133
134(defcustom erc-autoaway-idle-seconds 1800
135 "*Number of seconds after which ERC will set you automatically away.
136If you are changing this variable using lisp instead of customizing it,
137you have to run `erc-autoaway-reestablish-idletimer' afterwards."
138 :group 'erc-autoaway
139 :set (lambda (sym val)
140 (set-default sym val)
141 (when erc-autoaway-use-emacs-idle
142 (erc-autoaway-reestablish-idletimer)))
143 :type 'number)
144
145(defcustom erc-autoaway-message
146 "I'm gone (autoaway after %i seconds of idletime)"
147 "*Message ERC will use when he sets you automatically away.
148It is used as a `format' string with the argument of the idletime in
149seconds."
150 :group 'erc-autoaway
151 :type 'string)
152
153(defvar erc-autoaway-last-sent-time (erc-current-time)
154 "The last time the user sent something.")
155
156(defun erc-autoaway-reset-idletime (line &rest stuff)
157 "Reset the stored idletime for the user.
158This is one global variable since a user talking on one net can talk
159on another net too."
160 (when (and erc-auto-discard-away
161 (stringp line)
162 (not (string-match erc-autoaway-no-auto-discard-regexp line)))
163 (erc-autoaway-set-back line))
164 (setq erc-autoaway-last-sent-time (erc-current-time)))
165
166(defun erc-autoaway-set-back (line)
167 "Discard the away state globally."
168 (when (erc-away-p)
169 (setq erc-autoaway-last-sent-time (erc-current-time))
170 (erc-cmd-GAWAY "")))
171
172(defun erc-autoaway-possibly-set-away (current-time)
173 "Set autoaway when `erc-auto-set-away' is true and the idletime is
174exceeds `erc-autoaway-idle-seconds'."
175 ;; A test for (erc-server-process-alive) is not necessary, because
176 ;; this function is called from `erc-timer-hook', which is called
177 ;; whenever the server sends something to the client.
178 (when (and erc-auto-set-away
179 (not (erc-away-p)))
180 (let ((idle-time (erc-time-diff erc-autoaway-last-sent-time
181 current-time)))
182 (when (>= idle-time erc-autoaway-idle-seconds)
183 (erc-display-message
184 nil 'notice nil
185 (format "Setting automatically away after %i seconds of idle-time"
186 idle-time))
187 (erc-autoaway-set-away idle-time)))))
188
189(defun erc-autoaway-set-away (idle-time)
190 "Set the away state globally."
191 ;; Note that the idle timer runs, even when Emacs is inactive. In
192 ;; order to prevent flooding when we connect, we test for an
193 ;; existing process.
194 (when (and (erc-server-process-alive)
195 (not (erc-away-p)))
196 (erc-cmd-GAWAY (format erc-autoaway-message idle-time))))
197
198(provide 'erc-autoaway)
199
200;;; erc-autoaway.el ends here
201;;
202;; Local Variables:
203;; indent-tabs-mode: t
204;; tab-width: 8
205;; End:
206
207;; arch-tag: 16fc241e-8358-4b56-9fe2-116bdd0ba3bc
diff --git a/lisp/erc/erc-autojoin.el b/lisp/erc/erc-autojoin.el
new file mode 100644
index 00000000000..38a149d8921
--- /dev/null
+++ b/lisp/erc/erc-autojoin.el
@@ -0,0 +1,139 @@
1;;; erc-autojoin.el --- autojoin channels on connect and reconnects
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; Keywords: irc
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoJoin
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This allows us to customize an `erc-autojoin-channels-alist'. As
29;; we /JOIN and /PART channels, this alist is updated to reflect our
30;; current setup, so that when we reconnect, we rejoin the same
31;; channels. The alist can be customized, so that the customized
32;; value will be used when we reconnect in our next Emacs session.
33
34;;; Code:
35
36(require 'erc)
37;;; Minor Mode
38
39(defgroup erc-autojoin nil
40 "Enable autojoining."
41 :group 'erc)
42
43;;;###autoload (autoload 'erc-autojoin-mode "erc-autojoin" nil t)
44(define-erc-module autojoin nil
45 "Makes ERC autojoin on connects and reconnects."
46 ((add-hook 'erc-after-connect 'erc-autojoin-channels)
47 (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
48 (add-hook 'erc-server-PART-functions 'erc-autojoin-remove))
49 ((remove-hook 'erc-after-connect 'erc-autojoin-channels)
50 (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
51 (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove)))
52
53(defcustom erc-autojoin-channels-alist nil
54 "Alist of channels to autojoin on IRC networks.
55Every element in the alist has the form (SERVER . CHANNELS).
56SERVER is a regexp matching the server, and channels is the
57list of channels to join.
58
59Customize this variable to set the value for your first connect.
60Once you are connected and join and part channels, this alist
61keeps track of what channels you are on, and will join them
62again when you get disconnected. When you restart Emacs, however,
63those changes are lost, and the customization you saved the last
64time is used again."
65 :group 'erc-autojoin
66 :type '(repeat (cons :tag "Server"
67 (regexp :tag "Name")
68 (repeat :tag "Channels"
69 (string :tag "Name")))))
70
71(defcustom erc-autojoin-domain-only t
72 "Truncate host name to the domain name when joining a server.
73If non-nil, and a channel on the server a.b.c is joined, then
74only b.c is used as the server for `erc-autojoin-channels-alist'.
75This is important for networks that redirect you to other
76servers, presumably in the same domain."
77 :group 'erc-autojoin
78 :type 'boolean)
79
80(defun erc-autojoin-channels (server nick)
81 "Autojoin channels in `erc-autojoin-channels-alist'."
82 (dolist (l erc-autojoin-channels-alist)
83 (when (string-match (car l) server)
84 (dolist (chan (cdr l))
85 (erc-server-send (concat "join " chan))))))
86
87(defun erc-autojoin-add (proc parsed)
88 "Add the channel being joined to `erc-autojoin-channels-alist'."
89 (let* ((chnl (erc-response.contents parsed))
90 (nick (car (erc-parse-user (erc-response.sender parsed))))
91 (server (with-current-buffer (process-buffer proc)
92 (or erc-server-announced-name erc-session-server))))
93 (when (erc-current-nick-p nick)
94 (when (and erc-autojoin-domain-only
95 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server))
96 (setq server (match-string 1 server)))
97 (let ((elem (assoc server erc-autojoin-channels-alist)))
98 (if elem
99 (unless (member chnl (cdr elem))
100 (setcdr elem (cons chnl (cdr elem))))
101 (setq erc-autojoin-channels-alist
102 (cons (list server chnl)
103 erc-autojoin-channels-alist))))))
104 ;; We must return nil to tell ERC to continue running the other
105 ;; functions.
106 nil)
107
108;; (erc-parse-user "kensanata!~user@dclient217-162-233-228.hispeed.ch")
109
110(defun erc-autojoin-remove (proc parsed)
111 "Remove the channel being left from `erc-autojoin-channels-alist'."
112 (let* ((chnl (car (erc-response.command-args parsed)))
113 (nick (car (erc-parse-user (erc-response.sender parsed))))
114 (server (with-current-buffer (process-buffer proc)
115 (or erc-server-announced-name erc-session-server))))
116 (when (erc-current-nick-p nick)
117 (when (and erc-autojoin-domain-only
118 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server))
119 (setq server (match-string 1 server)))
120 (let ((elem (assoc server erc-autojoin-channels-alist)))
121 (when elem
122 (setcdr elem (delete chnl (cdr elem)))
123 (unless (cdr elem)
124 (setq erc-autojoin-channels-alist
125 (delete elem erc-autojoin-channels-alist)))))))
126 ;; We must return nil to tell ERC to continue running the other
127 ;; functions.
128 nil)
129
130(provide 'erc-autojoin)
131
132;;; erc-autojoin.el ends here
133;;
134;; Local Variables:
135;; indent-tabs-mode: t
136;; tab-width: 8
137;; End:
138
139;; arch-tag: d62d8b15-8e31-49d6-8a73-12f11e717414
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
new file mode 100644
index 00000000000..a99af9dea64
--- /dev/null
+++ b/lisp/erc/erc-backend.el
@@ -0,0 +1,1786 @@
1;;; erc-backend.el --- Backend network communication for ERC
2
3;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
4
5;; Filename: erc-backend.el
6;; Author: Lawrence Mitchell <wence@gmx.li>
7;; Created: 2004-05-7
8;; Keywords: IRC chat client internet
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28
29;; This file defines backend network communication handlers for ERC.
30;;
31;; How things work:
32;;
33;; You define a new handler with `define-erc-response-handler'. This
34;; defines a function, a corresponding hook variable, and populates a
35;; global hash table `erc-server-responses' with a map from response
36;; to hook variable. See the function documentation for more
37;; information.
38;;
39;; Upon receiving a line from the server, `erc-parse-server-response'
40;; is called on it.
41;;
42;; A line generally looks like:
43;;
44;; LINE := ':' SENDER ' ' COMMAND ' ' (COMMAND-ARGS ' ')* ':' CONTENTS
45;; SENDER := Not ':' | ' '
46;; COMMAND := Not ':' | ' '
47;; COMMAND-ARGS := Not ':' | ' '
48;;
49;; This gets parsed and stuffed into an `erc-response' struct. You
50;; can access the fields of the struct with:
51;;
52;; COMMAND --- `erc-response.command'
53;; COMMAND-ARGS --- `erc-response.command-args'
54;; CONTENTS --- `erc-response.contents'
55;; SENDER --- `erc-response.sender'
56;; LINE --- `erc-response.unparsed'
57;;
58;; WARNING, WARNING!!
59;; It's probably not a good idea to destructively modify the list
60;; of command-args in your handlers, since other functions down the
61;; line may well need to access the arguments too.
62;;
63;; That is, unless you're /absolutely/ sure that your handler doesn't
64;; invoke some other function that needs to use COMMAND-ARGS, don't do
65;; something like
66;;
67;; (while (erc-response.command-args parsed)
68;; (let ((a (pop (erc-response.command-args parsed))))
69;; ...))
70;;
71;; The parsed response is handed over to
72;; `erc-handle-parsed-server-response', which checks whether it should
73;; carry out duplicate suppression, and then runs `erc-call-hooks'.
74;; `erc-call-hooks' retrieves the relevant hook variable from
75;; `erc-server-responses' and runs it.
76;;
77;; Most handlers then destructure the parsed response in some way
78;; (depending on what the handler is, the arguments have different
79;; meanings), and generally display something, usually using
80;; `erc-display-message'.
81
82;;; TODO:
83
84;; o Generalise the display-line code so that we can use it to
85;; display the stuff we send, as well as the stuff we receive.
86;; Then, move all display-related code into another backend-like
87;; file, erc-display.el, say.
88;;
89;; o Clean up the handlers using new display code (has to be written
90;; first).
91
92;;; History:
93
94;; 2004/05/10 -- Handler bodies taken out of erc.el and ported to new
95;; interface.
96
97;; 2005-08-13 -- Moved sending commands from erc.el.
98
99;;; Code:
100
101(require 'erc-compat)
102(eval-when-compile (require 'cl))
103(autoload 'erc-with-buffer "erc" nil nil 'macro)
104(autoload 'erc-log "erc" nil nil 'macro)
105
106;;;; Variables and options
107
108(defvar erc-server-responses (make-hash-table :test #'equal)
109 "Hashtable mapping server responses to their handler hooks.")
110
111(defstruct (erc-response (:conc-name erc-response.))
112 (unparsed "" :type string)
113 (sender "" :type string)
114 (command "" :type string)
115 (command-args '() :type list)
116 (contents "" :type string))
117
118;;; User data
119
120(defvar erc-server-current-nick nil
121 "Nickname on the current server.
122Use `erc-current-nick' to access this.")
123(make-variable-buffer-local 'erc-server-current-nick)
124
125;;; Server attributes
126
127(defvar erc-server-process nil
128 "The process object of the corresponding server connection.")
129(make-variable-buffer-local 'erc-server-process)
130
131(defvar erc-session-server nil
132 "The server name used to connect to for this session.")
133(make-variable-buffer-local 'erc-session-server)
134
135(defvar erc-session-port nil
136 "The port used to connect to.")
137(make-variable-buffer-local 'erc-session-port)
138
139(defvar erc-server-announced-name nil
140 "The name the server announced to use.")
141(make-variable-buffer-local 'erc-server-announced-name)
142
143(defvar erc-server-version nil
144 "The name and version of the server's ircd.")
145(make-variable-buffer-local 'erc-server-version)
146
147(defvar erc-server-parameters nil
148 "Alist listing the supported server parameters.
149
150This is only set if the server sends 005 messages saying what is
151supported on the server.
152
153Entries are of the form:
154 (PARAMETER . VALUE)
155or
156 (PARAMETER) if no value is provided.
157
158Some examples of possible parameters sent by servers:
159CHANMODES=b,k,l,imnpst - list of supported channel modes
160CHANNELLEN=50 - maximum length of channel names
161CHANTYPES=#&!+ - supported channel prefixes
162CHARMAPPING=rfc1459 - character mapping used for nickname and channels
163KICKLEN=160 - maximum allowed kick message length
164MAXBANS=30 - maximum number of bans per channel
165MAXCHANNELS=10 - maximum number of channels allowed to join
166NETWORK=EFnet - the network identifier
167NICKLEN=9 - maximum allowed length of nicknames
168PREFIX=(ov)@+ - list of channel modes and the user prefixes if user has mode
169RFC2812 - server supports RFC 2812 features
170SILENCE=10 - supports the SILENCE command, maximum allowed number of entries
171TOPICLEN=160 - maximum allowed topic length
172WALLCHOPS - supports sending messages to all operators in a channel")
173(make-variable-buffer-local 'erc-server-parameters)
174
175;;; Server and connection state
176
177(defvar erc-server-connected nil
178 "Non-nil if the `current-buffer' is associated with an open IRC connection.
179This variable is buffer-local.")
180(make-variable-buffer-local 'erc-server-connected)
181
182(defvar erc-server-quitting nil
183 "Non-nil if the user requests a quit.")
184(make-variable-buffer-local 'erc-server-quitting)
185
186(defvar erc-server-lines-sent nil
187 "Line counter.")
188(make-variable-buffer-local 'erc-server-lines-sent)
189
190(defvar erc-server-last-peers '(nil . nil)
191 "Last peers used, both sender and receiver.
192Those are used for /MSG destination shortcuts.")
193(make-variable-buffer-local 'erc-server-last-peers)
194
195(defvar erc-server-last-sent-time nil
196 "Time the message was sent.
197This is useful for flood protection.")
198(make-variable-buffer-local 'erc-server-last-sent-time)
199
200(defvar erc-server-last-ping-time nil
201 "Time the last ping was sent.
202This is useful for flood protection.")
203(make-variable-buffer-local 'erc-server-last-ping-time)
204
205(defvar erc-server-lag nil
206 "Calculated server lag time in seconds.
207This variable is only set in a server buffer.")
208(make-variable-buffer-local 'erc-server-lag)
209
210(defvar erc-server-filter-data nil
211 "The data that arrived from the server
212but has not been processed yet.")
213(make-variable-buffer-local 'erc-server-filter-data)
214
215(defvar erc-server-duplicates (make-hash-table :test 'equal)
216 "Internal variable used to track duplicate messages.")
217(make-variable-buffer-local 'erc-server-duplicates)
218
219;; From Circe
220(defvar erc-server-processing-p nil
221 "Non-nil when we're currently processing a message.
222
223When ERC receives a private message, it sets up a new buffer for
224this query. These in turn, though, do start flyspell. This
225involves starting an external process, in which case Emacs will
226wait - and when it waits, it does accept other stuff from, say,
227network exceptions. So, if someone sends you two messages
228quickly after each other, ispell is started for the first, but
229might take long enough for the second message to be processed
230first.")
231(make-variable-buffer-local 'erc-server-processing-p)
232
233(defvar erc-server-flood-last-message 0
234 "When we sent the last message.
235See `erc-server-flood-margin' for an explanation of the flood
236protection algorithm.")
237(make-variable-buffer-local 'erc-server-flood-last-message)
238
239(defvar erc-server-flood-queue nil
240 "The queue of messages waiting to be sent to the server.
241See `erc-server-flood-margin' for an explanation of the flood
242protection algorithm.")
243(make-variable-buffer-local 'erc-server-flood-queue)
244
245(defvar erc-server-flood-timer nil
246 "The timer to resume sending.")
247(make-variable-buffer-local 'erc-server-flood-timer)
248
249;;; IRC protocol and misc options
250
251(defgroup erc-server nil
252 "Parameters for dealing with IRC servers."
253 :group 'erc)
254
255(defcustom erc-server-auto-reconnect t
256 "Non-nil means that ERC will attempt to reestablish broken connections.
257
258Reconnection will happen automatically for any unexpected disconnection."
259 :group 'erc-server
260 :type 'boolean)
261
262(defcustom erc-split-line-length 440
263 "*The maximum length of a single message.
264If a message exceeds this size, it is broken into multiple ones.
265
266IRC allows for lines up to 512 bytes. Two of them are CR LF.
267And a typical message looks like this:
268
269 :nicky!uhuser@host212223.dialin.fnordisp.net PRIVMSG #lazybastards :Hello!
270
271You can limit here the maximum length of the \"Hello!\" part.
272Good luck."
273 :type 'integer
274 :group 'erc-server)
275
276(defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p)
277 (coding-system-p 'undecided)
278 (coding-system-p 'utf-8))
279 '(utf-8 . undecided)
280 nil)
281 "The default coding system for incoming and outgoing text.
282This is either a coding system, a cons, a function, or nil.
283
284If a cons, the encoding system for outgoing text is in the car
285and the decoding system for incoming text is in the cdr. The most
286interesting use for this is to put `undecided' in the cdr. If a
287function, it is called with no arguments and should return a
288coding system or a cons as described above. Note that you can use
289the dynamically bound variable `target' to get the current
290target. See `erc-coding-system-for-target'.
291
292If you need to send non-ASCII text to people not using a client that
293does decoding on its own, you must tell ERC what encoding to use.
294Emacs cannot guess it, since it does not know what the people on the
295other end of the line are using."
296 :group 'erc-server
297 :type '(choice (const :tag "None" nil)
298 coding-system
299 (cons (coding-system :tag "encoding" :value utf-8)
300 (coding-system :tag "decoding" :value undecided))
301 function))
302
303(defcustom erc-encoding-coding-alist nil
304 "Alist of target regexp and coding-system pairs to use.
305This overrides `erc-server-coding-system' depending on the
306current target as returned by `erc-default-target'.
307
308Example: If you know that the channel #linux-ru uses the coding-system
309`cyrillic-koi8', then add '(\"#linux-ru\" . cyrillic-koi8) to the
310alist."
311 :group 'erc-server
312 :type '(repeat (cons (string :tag "Target")
313 coding-system)))
314
315(defcustom erc-server-connect-function
316 (if (and (fboundp 'open-network-stream-nowait)
317 ;; CVS Emacs claims to define open-network-stream-nowait on
318 ;; windows, however, it does, in fact, not work.
319 (not (memq system-type '(windows-nt cygwin ms-dos darwin))))
320 'open-network-stream-nowait
321 'open-network-stream)
322 "Function used to initiate a connection.
323It should take same arguments as `open-network-stream' does."
324 :group 'erc-server
325 :type 'function)
326
327(defcustom erc-server-prevent-duplicates '("301")
328 "*Either nil or a list of strings.
329Each string is a IRC message type, like PRIVMSG or NOTICE.
330All Message types in that list of subjected to duplicate prevention."
331 :type '(choice (const nil) (list string))
332 :group 'erc-server)
333
334(defcustom erc-server-duplicate-timeout 60
335 "*The time allowed in seconds between duplicate messages.
336
337If two identical messages arrive within this value of one another, the second
338isn't displayed."
339 :type 'integer
340 :group 'erc-server)
341
342;;; Flood-related
343
344;; Most of this is courtesy of Jorgen Schaefer and Circe
345;; (http://www.nongnu.org/circe)
346
347(defcustom erc-server-flood-margin 10
348 "*A margin on how much excess data we send.
349The flood protection algorithm of ERC works like the one
350detailed in RFC 2813, section 5.8 \"Flood control of clients\".
351
352 * If `erc-server-flood-last-message' is less than the current
353 time, set it equal.
354 * While `erc-server-flood-last-message' is less than
355 `erc-server-flood-margin' seconds ahead of the current
356 time, send a message, and increase
357 `erc-server-flood-last-message' by
358 `erc-server-flood-penalty' for each message."
359 :type 'integer
360 :group 'erc-server)
361
362(defcustom erc-server-flood-penalty 3
363 "How much we penalize a message.
364See `erc-server-flood-margin' for an explanation of the flood
365protection algorithm."
366 :type 'integer
367 :group 'erc-server)
368
369;; Ping handling
370
371(defcustom erc-server-send-ping-interval 90
372 "*Interval of sending pings to the server, in seconds.
373If this is set to nil, pinging the server is disabled."
374 :group 'erc-server
375 :type '(choice (const nil) (integer :tag "Seconds")))
376
377(defvar erc-server-ping-handler nil
378 "This variable holds the periodic ping timer.")
379(make-variable-buffer-local 'erc-server-ping-handler)
380
381;;;; Helper functions
382
383;; From Circe
384(defun erc-split-line (longline)
385 "Return a list of lines which are not too long for IRC.
386The length is specified in `erc-split-line-length'.
387
388Currently this is called by `erc-send-input'."
389 (if (< (length longline)
390 erc-split-line-length)
391 (list longline)
392 (with-temp-buffer
393 (insert longline)
394 (let ((fill-column erc-split-line-length))
395 (fill-region (point-min) (point-max)
396 nil t))
397 (split-string (buffer-string) "\n"))))
398
399;; Used by CTCP functions
400(defun erc-upcase-first-word (str)
401 "Upcase the first word in STR."
402 (with-temp-buffer
403 (insert str)
404 (goto-char (point-min))
405 (upcase-word 1)
406 (buffer-string)))
407
408(defun erc-server-setup-periodical-server-ping (&rest ignore)
409 "Set up a timer to periodically ping the current server."
410 (and erc-server-ping-handler (erc-cancel-timer erc-server-ping-handler))
411 (when erc-server-send-ping-interval
412 (setq erc-server-ping-handler
413 (run-with-timer
414 4 erc-server-send-ping-interval
415 (lambda (buf)
416 (when (buffer-live-p buf)
417 (with-current-buffer buf
418 (erc-server-send
419 (format "PING %.0f"
420 (erc-current-time))))))
421 (current-buffer)))))
422
423(defun erc-server-process-alive ()
424 "Return non-nil when `erc-server-process' is open or running."
425 (and (boundp 'erc-server-process)
426 (processp erc-server-process)
427 (memq (process-status erc-server-process) '(run open))))
428
429;;;; Connecting to a server
430
431(defun erc-server-connect (server port)
432 "Perform the connection and login.
433We will store server variables in the current buffer."
434 (let ((msg (erc-format-message 'connect ?S server ?p port)))
435 (message "%s" msg)
436 (setq erc-server-process
437 (funcall erc-server-connect-function
438 (format "erc-%s-%s" server port)
439 (current-buffer) server port))
440 (message "%s...done" msg))
441 ;; Misc server variables
442 (setq erc-server-quitting nil)
443 (setq erc-server-last-sent-time (erc-current-time))
444 (setq erc-server-last-ping-time (erc-current-time))
445 (setq erc-server-lines-sent 0)
446 ;; last peers (sender and receiver)
447 (setq erc-server-last-peers '(nil . nil))
448 ;; process handlers
449 (set-process-sentinel erc-server-process 'erc-process-sentinel)
450 (set-process-filter erc-server-process 'erc-server-filter-function)
451 ;; we do our own encoding and decoding
452 (when (fboundp 'set-process-coding-system)
453 (set-process-coding-system erc-server-process 'raw-text))
454 (set-marker (process-mark erc-server-process) (point))
455 (erc-log "\n\n\n********************************************\n")
456 (message (erc-format-message 'login ?n (erc-current-nick)))
457 ;; wait with script loading until we receive a confirmation (first
458 ;; MOTD line)
459 (if (eq erc-server-connect-function 'open-network-stream-nowait)
460 ;; it's a bit unclear otherwise that it's attempting to establish a
461 ;; connection
462 (erc-display-message nil nil (current-buffer)
463 "Opening connection..\n")
464 (erc-login)))
465
466(defun erc-server-filter-function (process string)
467 "The process filter for the ERC server."
468 (with-current-buffer (process-buffer process)
469 ;; If you think this is written in a weird way - please refer to the
470 ;; docstring of `erc-server-processing-p'
471 (if erc-server-processing-p
472 (setq erc-server-filter-data
473 (if erc-server-filter-data
474 (concat erc-server-filter-data string)
475 string))
476 ;; This will be true even if another process is spawned!
477 (let ((erc-server-processing-p t))
478 (setq erc-server-filter-data (if erc-server-filter-data
479 (concat erc-server-filter-data
480 string)
481 string))
482 (while (and erc-server-filter-data
483 (string-match "[\n\r]+" erc-server-filter-data))
484 (let ((line (substring erc-server-filter-data
485 0 (match-beginning 0))))
486 (setq erc-server-filter-data
487 (if (= (match-end 0)
488 (length erc-server-filter-data))
489 nil
490 (substring erc-server-filter-data
491 (match-end 0))))
492 (erc-parse-server-response process line)))))))
493
494(defun erc-process-sentinel-1 (event)
495 "This will be called when erc-process-sentinel has decided that we
496are going to quit. Determine whether user has quit or whether erc has
497been terminated. Conditionally try to reconnect and take appropriate
498action."
499 (if erc-server-quitting
500 ;; normal quit
501 (progn
502 (let ((string "\n\n*** ERC finished ***\n")
503 (inhibit-read-only t))
504 (erc-put-text-property 0 (length string)
505 'face 'erc-error-face string)
506 (insert string))
507 (when erc-kill-server-buffer-on-quit
508 (set-buffer-modified-p nil)
509 (kill-buffer (current-buffer))))
510 ;; unexpected disconnect
511 (erc-display-message nil 'error (current-buffer)
512 (if erc-server-auto-reconnect
513 'disconnected
514 'disconnected-noreconnect))
515 (erc-update-mode-line)
516 (erc-set-active-buffer (current-buffer))
517 (setq erc-server-last-sent-time 0)
518 (setq erc-server-lines-sent 0)
519 (if (and erc-server-auto-reconnect
520 (not (string-match "^deleted" event))
521 ;; open-network-stream-nowait error for connection refused
522 (not (string-match "^failed with code 111" event)))
523 ;; Yuck, this should perhaps funcall
524 ;; erc-server-reconnect-function with no args
525 (erc erc-session-server erc-session-port erc-server-current-nick
526 erc-session-user-full-name t erc-session-password)
527 ;; terminate, do not reconnect
528 (let ((string (concat "\n\n*** ERC terminated: " event
529 "\n"))
530 (inhibit-read-only t))
531 (erc-put-text-property 0 (length string)
532 'face 'erc-error-face string)
533 (insert string)))))
534
535(defun erc-process-sentinel (cproc event)
536 "Sentinel function for ERC process."
537 (with-current-buffer (process-buffer cproc)
538 (erc-log (format
539 "SENTINEL: proc: %S status: %S event: %S (quitting: %S)"
540 cproc (process-status cproc) event erc-server-quitting))
541 (if (string-match "^open" event)
542 ;; newly opened connection (no wait)
543 (erc-login)
544 ;; assume event is 'failed
545 (let ((buf (process-buffer cproc)))
546 (erc-with-all-buffers-of-server cproc nil
547 (setq erc-server-connected nil))
548 (when erc-server-ping-handler
549 (progn (erc-cancel-timer erc-server-ping-handler)
550 (setq erc-server-ping-handler nil)))
551 (run-hook-with-args 'erc-disconnected-hook
552 (erc-current-nick) (system-name) "")
553 ;; Remove the prompt
554 (forward-line 0)
555 (erc-remove-text-properties-region (point) (point-max))
556 (delete-region (point) (point-max))
557 ;; Decide what to do with the buffer
558 ;; Restart if disconnected
559 (erc-process-sentinel-1 event)
560 ;; Make sure we don't write to the buffer if it has been
561 ;; killed
562 (when (buffer-live-p buf)
563 (erc-update-mode-line)
564 (set-buffer-modified-p nil))))))
565
566;;;; Sending messages
567
568(defun erc-coding-system-for-target (target)
569 "Return the coding system or cons cell appropriate for TARGET.
570This is determined via `erc-encoding-coding-alist' or
571`erc-server-coding-system'."
572 (or (cdr (assoc target erc-encoding-coding-alist))
573 (and (functionp erc-server-coding-system)
574 (funcall erc-server-coding-system))
575 erc-server-coding-system))
576
577(defun erc-decode-string-from-target (str target)
578 "Decode STR as appropriate for TARGET.
579This is indicated by `erc-encoding-coding-alist', defaulting to the value of
580`erc-server-coding-system'."
581 (unless (stringp str)
582 (setq str ""))
583 (let ((coding (erc-coding-system-for-target target)))
584 (when (consp coding)
585 (setq coding (cdr coding)))
586 (erc-decode-coding-string str coding)))
587
588;; proposed name, not used by anything yet
589(defun erc-send-line (text display-fn)
590 "Send TEXT to the current server. Wrapping and flood control apply.
591Use DISPLAY-FN to show the results."
592 (mapc (lambda (line)
593 (erc-server-send line)
594 (funcall display-fn))
595 (erc-split-line text)))
596
597;; From Circe, with modifications
598(defun erc-server-send (string &optional forcep target)
599 "Send STRING to the current server.
600If FORCEP is non-nil, no flood protection is done - the string is
601sent directly. This might cause the messages to arrive in a wrong
602order.
603
604If TARGET is specified, look up encoding information for that
605channel in `erc-encoding-coding-alist' or
606`erc-server-coding-system'.
607
608See `erc-server-flood-margin' for an explanation of the flood
609protection algorithm."
610 (erc-log (concat "erc-server-send: " string "(" (buffer-name) ")"))
611 (setq erc-server-last-sent-time (erc-current-time))
612 (let ((buf (erc-server-buffer))
613 (encoding (erc-coding-system-for-target
614 (or target (erc-default-target)))))
615 (when (consp encoding)
616 (setq encoding (car encoding)))
617 (if (and buf
618 (erc-server-process-alive))
619 (with-current-buffer buf
620 (let ((str (concat string "\r\n")))
621 (if forcep
622 (progn
623 (setq erc-server-flood-last-message
624 (+ erc-server-flood-penalty
625 erc-server-flood-last-message))
626 (erc-log-irc-protocol str 'outbound)
627 (condition-case err
628 (progn
629 ;; Set encoding just before sending the string
630 (when (fboundp 'set-process-coding-system)
631 (set-process-coding-system erc-server-process
632 'raw-text encoding))
633 (process-send-string erc-server-process str))
634 ;; See `erc-server-send-queue' for full
635 ;; explanation of why we need this condition-case
636 (error nil)))
637 (setq erc-server-flood-queue
638 (append erc-server-flood-queue
639 (list (cons str encoding))))
640 (erc-server-send-queue (current-buffer))))
641 t)
642 (message "ERC: No process running")
643 nil)))
644
645;; From Circe
646(defun erc-server-send-queue (buffer)
647 "Send messages in `erc-server-flood-queue'.
648See `erc-server-flood-margin' for an explanation of the flood
649protection algorithm."
650 (with-current-buffer buffer
651 (let ((now (erc-current-time)))
652 (when erc-server-flood-timer
653 (erc-cancel-timer erc-server-flood-timer)
654 (setq erc-server-flood-timer nil))
655 (when (< erc-server-flood-last-message
656 now)
657 (setq erc-server-flood-last-message now))
658 (while (and erc-server-flood-queue
659 (< erc-server-flood-last-message
660 (+ now erc-server-flood-margin)))
661 (let ((msg (caar erc-server-flood-queue))
662 (encoding (cdar erc-server-flood-queue)))
663 (setq erc-server-flood-queue (cdr erc-server-flood-queue)
664 erc-server-flood-last-message
665 (+ erc-server-flood-last-message
666 erc-server-flood-penalty))
667 (erc-log-irc-protocol msg 'outbound)
668 (erc-log (concat "erc-server-send-queue: "
669 msg "(" (buffer-name buffer) ")"))
670 (when (erc-server-process-alive)
671 (condition-case err
672 ;; Set encoding just before sending the string
673 (progn
674 (when (fboundp 'set-process-coding-system)
675 (set-process-coding-system erc-server-process
676 'raw-text encoding))
677 (process-send-string erc-server-process msg))
678 ;; Sometimes the send can occur while the process is
679 ;; being killed, which results in a weird SIGPIPE error.
680 ;; Catch this and ignore it.
681 (error nil)))))
682 (when erc-server-flood-queue
683 (setq erc-server-flood-timer
684 (run-at-time 2 nil #'erc-server-send-queue buffer))))))
685
686(defun erc-message (message-command line &optional force)
687 "Send LINE to the server as a privmsg or a notice.
688MESSAGE-COMMAND should be either \"PRIVMSG\" or \"NOTICE\".
689If the target is \",\", the last person you've got a message from will
690be used. If the target is \".\", the last person you've sent a message
691to will be used."
692 (cond
693 ((string-match "^\\s-*\\(\\S-+\\) ?\\(.*\\)" line)
694 (let ((tgt (match-string 1 line))
695 (s (match-string 2 line)))
696 (erc-log (format "cmd: MSG(%s): [%s] %s" message-command tgt s))
697 (cond
698 ((string= tgt ",")
699 (if (car erc-server-last-peers)
700 (setq tgt (car erc-server-last-peers))
701 (setq tgt nil)))
702 ((string= tgt ".")
703 (if (cdr erc-server-last-peers)
704 (setq tgt (cdr erc-server-last-peers))
705 (setq tgt nil))))
706 (cond
707 (tgt
708 (setcdr erc-server-last-peers tgt)
709 (erc-server-send (format "%s %s :%s" message-command tgt s)
710 force))
711 (t
712 (erc-display-message nil 'error (current-buffer) 'no-target))))
713 t)
714 (t nil)))
715
716;;; CTCP
717
718(defun erc-send-ctcp-message (tgt l &optional force)
719 "Send CTCP message L to TGT.
720
721If TGT is nil the message is not sent.
722The command must contain neither a prefix nor a trailing `\\n'.
723
724See also `erc-server-send'."
725 (let ((l (erc-upcase-first-word l)))
726 (cond
727 (tgt
728 (erc-log (format "erc-send-CTCP-message: [%s] %s" tgt l))
729 (erc-server-send (format "PRIVMSG %s :\C-a%s\C-a" tgt l)
730 force)))))
731
732(defun erc-send-ctcp-notice (tgt l &optional force)
733 "Send CTCP notice L to TGT.
734
735If TGT is nil the message is not sent.
736The command must contain neither a prefix nor a trailing `\\n'.
737
738See also `erc-server-send'."
739 (let ((l (erc-upcase-first-word l)))
740 (cond
741 (tgt
742 (erc-log (format "erc-send-CTCP-notice: [%s] %s" tgt l))
743 (erc-server-send (format "NOTICE %s :\C-a%s\C-a" tgt l)
744 force)))))
745
746;;;; Handling responses
747
748(defun erc-parse-server-response (proc string)
749 "Parse and act upon a complete line from an IRC server.
750PROC is the process (connection) from which STRING was received.
751PROCs `process-buffer' is `current-buffer' when this function is called."
752 (unless (string= string "") ;; Ignore empty strings
753 (save-match-data
754 (let ((posn (if (eq (aref string 0) ?:)
755 (string-match " " string)
756 0))
757 (msg (make-erc-response :unparsed string)))
758
759 (setf (erc-response.sender msg)
760 (if (eq posn 0)
761 erc-session-server
762 (substring string 1 posn)))
763
764 (setf (erc-response.command msg)
765 (let* ((bposn (string-match "[^ ]" string posn))
766 (eposn (string-match " " string bposn)))
767 (setq posn (and eposn
768 (string-match "[^ ]" string eposn)))
769 (substring string bposn eposn)))
770
771 (while (and posn
772 (not (eq (aref string posn) ?:)))
773 (push (let* ((bposn posn)
774 (eposn (string-match " " string bposn)))
775 (setq posn (and eposn
776 (string-match "[^ ]" string eposn)))
777 (substring string bposn eposn))
778 (erc-response.command-args msg)))
779 (when posn
780 (let ((str (substring string (1+ posn))))
781 (push str (erc-response.command-args msg))))
782
783 (setf (erc-response.contents msg)
784 (first (erc-response.command-args msg)))
785
786 (setf (erc-response.command-args msg)
787 (nreverse (erc-response.command-args msg)))
788
789 (erc-decode-parsed-server-response msg)
790
791 (erc-handle-parsed-server-response proc msg)))))
792
793(defun erc-decode-parsed-server-response (parsed-response)
794 "Decode a pre-parsed PARSED-RESPONSE before it can be handled.
795
796If there is a channel name in `erc-response.command-args', decode
797`erc-response' according to this channel name and
798`erc-encoding-coding-alist', or use `erc-server-coding-system'
799for decoding."
800 (let ((args (erc-response.command-args parsed-response))
801 (decode-target nil)
802 (decoded-args ()))
803 (dolist (arg args nil)
804 (when (string-match "^[#&].*" arg)
805 (setq decode-target arg)))
806 (when (stringp decode-target)
807 (setq decode-target (erc-decode-string-from-target decode-target nil)))
808 (setf (erc-response.unparsed parsed-response)
809 (erc-decode-string-from-target
810 (erc-response.unparsed parsed-response)
811 decode-target))
812 (setf (erc-response.sender parsed-response)
813 (erc-decode-string-from-target
814 (erc-response.sender parsed-response)
815 decode-target))
816 (setf (erc-response.command parsed-response)
817 (erc-decode-string-from-target
818 (erc-response.command parsed-response)
819 decode-target))
820 (dolist (arg (nreverse args) nil)
821 (push (erc-decode-string-from-target arg decode-target)
822 decoded-args))
823 (setf (erc-response.command-args parsed-response) decoded-args)
824 (setf (erc-response.contents parsed-response)
825 (erc-decode-string-from-target
826 (erc-response.contents parsed-response)
827 decode-target))))
828
829(defun erc-handle-parsed-server-response (process parsed-response)
830 "Handle a pre-parsed PARSED-RESPONSE from PROCESS.
831
832Hands off to helper functions via `erc-call-hooks'."
833 (if (member (erc-response.command parsed-response)
834 erc-server-prevent-duplicates)
835 (let ((m (erc-response.unparsed parsed-response)))
836 ;; duplicate supression
837 (if (< (or (gethash m erc-server-duplicates) 0)
838 (- (erc-current-time) erc-server-duplicate-timeout))
839 (erc-call-hooks process parsed-response))
840 (puthash m (erc-current-time) erc-server-duplicates))
841 ;; Hand off to the relevant handler.
842 (erc-call-hooks process parsed-response)))
843
844(defun erc-get-hook (command)
845 "Return the hook variable associated with COMMAND.
846
847See also `erc-server-responses'."
848 (gethash (format (if (numberp command) "%03i" "%s") command)
849 erc-server-responses))
850
851(defun erc-call-hooks (process message)
852 "Call hooks associated with MESSAGE in PROCESS.
853
854Finds hooks by looking in the `erc-server-responses' hashtable."
855 (let ((hook (or (erc-get-hook (erc-response.command message))
856 'erc-default-server-functions)))
857 (run-hook-with-args-until-success hook process message)
858 (with-current-buffer (erc-server-buffer)
859 (run-hook-with-args 'erc-timer-hook (erc-current-time)))))
860
861(add-hook 'erc-default-server-functions 'erc-handle-unknown-server-response)
862
863(defun erc-handle-unknown-server-response (proc parsed)
864 "Display unknown server response's message."
865 (let ((line (concat (erc-response.sender parsed)
866 " "
867 (erc-response.command parsed)
868 " "
869 (mapconcat 'identity (erc-response.command-args parsed)
870 " "))))
871 (erc-display-message parsed 'notice proc line)))
872
873
874(put 'define-erc-response-handler 'edebug-form-spec
875 '(&define :name erc-response-handler
876 (name &rest name)
877 &optional sexp sexp def-body))
878
879(defmacro* define-erc-response-handler ((name &rest aliases)
880 &optional extra-fn-doc extra-var-doc
881 &rest fn-body)
882 "Define an ERC handler hook/function pair.
883NAME is the response name as sent by the server (see the IRC RFC for
884meanings).
885
886This creates:
887 - a hook variable `erc-server-NAME-functions' initialised to `erc-server-NAME'.
888 - a function `erc-server-NAME' with body FN-BODY.
889
890If ALIASES is non-nil, each alias in ALIASES is `defalias'ed to
891`erc-server-NAME'.
892Alias hook variables are created as `erc-server-ALIAS-functions' and
893initialised to the same default value as `erc-server-NAME-functions'.
894
895FN-BODY is the body of `erc-server-NAME' it may refer to the two
896function arguments PROC and PARSED.
897
898If EXTRA-FN-DOC is non-nil, it is inserted at the beginning of the
899defined function's docstring.
900
901If EXTRA-VAR-DOC is non-nil, it is inserted at the beginning of the
902defined variable's docstring.
903
904As an example:
905
906 (define-erc-response-handler (311 WHOIS WI)
907 \"Some non-generic function documentation.\"
908 \"Some non-generic variable documentation.\"
909 (do-stuff-with-whois proc parsed))
910
911Would expand to:
912
913 (prog2
914 (defvar erc-server-311-functions 'erc-server-311
915 \"Some non-generic variable documentation.
916
917 Hook called upon receiving a 311 server response.
918 Each function is called with two arguments, the process associated
919 with the response and the parsed response.
920 See also `erc-server-311'.\")
921
922 (defun erc-server-311 (proc parsed)
923 \"Some non-generic function documentation.
924
925 Handler for a 311 server response.
926 PROC is the server process which returned the response.
927 PARSED is the actual response as an `erc-response' struct.
928 If you want to add responses don't modify this function, but rather
929 add things to `erc-server-311-functions' instead.\"
930 (do-stuff-with-whois proc parsed))
931
932 (puthash \"311\" 'erc-server-311-functions erc-server-responses)
933 (puthash \"WHOIS\" 'erc-server-WHOIS-functions erc-server-responses)
934 (puthash \"WI\" 'erc-server-WI-functions erc-server-responses)
935
936 (defalias 'erc-server-WHOIS 'erc-server-311)
937 (defvar erc-server-WHOIS-functions 'erc-server-311
938 \"Some non-generic variable documentation.
939
940 Hook called upon receiving a WHOIS server response.
941 Each function is called with two arguments, the process associated
942 with the response and the parsed response.
943 See also `erc-server-311'.\")
944
945 (defalias 'erc-server-WI 'erc-server-311)
946 (defvar erc-server-WI-functions 'erc-server-311
947 \"Some non-generic variable documentation.
948
949 Hook called upon receiving a WI server response.
950 Each function is called with two arguments, the process associated
951 with the response and the parsed response.
952 See also `erc-server-311'.\"))
953
954\(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)"
955 (if (numberp name) (setq name (intern (format "%03i" name))))
956 (setq aliases (mapcar (lambda (a)
957 (if (numberp a)
958 (format "%03i" a)
959 a))
960 aliases))
961 (let* ((hook-name (intern (format "erc-server-%s-functions" name)))
962 (fn-name (intern (format "erc-server-%s" name)))
963 (hook-doc (format "%sHook called upon receiving a %%s server response.
964Each function is called with two arguments, the process associated
965with the response and the parsed response.
966See also `%s'."
967 (if extra-var-doc
968 (concat extra-var-doc "\n\n")
969 "")
970 fn-name))
971 (fn-doc (format "%sHandler for a %s server response.
972PROC is the server process which returned the response.
973PARSED is the actual response as an `erc-response' struct.
974If you want to add responses don't modify this function, but rather
975add things to `%s' instead."
976 (if extra-fn-doc
977 (concat extra-fn-doc "\n\n")
978 "")
979 name hook-name))
980 (fn-alternates
981 (loop for alias in aliases
982 collect (intern (format "erc-server-%s" alias))))
983 (var-alternates
984 (loop for alias in aliases
985 collect (intern (format "erc-server-%s-functions" alias)))))
986 `(prog2
987 ;; Normal hook variable.
988 (defvar ,hook-name ',fn-name ,(format hook-doc name))
989 ;; Handler function
990 (defun ,fn-name (proc parsed)
991 ,fn-doc
992 ,@fn-body)
993
994 ;; Make find-function and find-variable find them
995 (put ',fn-name 'definition-name ',name)
996 (put ',hook-name 'definition-name ',name)
997
998 ;; Hashtable map of responses to hook variables
999 ,@(loop for response in (cons name aliases)
1000 for var in (cons hook-name var-alternates)
1001 collect `(puthash ,(format "%s" response) ',var
1002 erc-server-responses))
1003 ;; Alternates.
1004 ;; Functions are defaliased, hook variables are defvared so we
1005 ;; can add hooks to one alias, but not another.
1006 ,@(loop for fn in fn-alternates
1007 for var in var-alternates
1008 for a in aliases
1009 nconc (list `(defalias ',fn ',fn-name)
1010 `(defvar ,var ',fn-name ,(format hook-doc a))
1011 `(put ',var 'definition-name ',hook-name))))))
1012
1013(define-erc-response-handler (ERROR)
1014 "Handle an ERROR command from the server." nil
1015 (erc-display-message
1016 parsed 'error nil 'ERROR
1017 ?s (erc-response.sender parsed) ?c (erc-response.contents parsed)))
1018
1019(define-erc-response-handler (INVITE)
1020 "Handle invitation messages."
1021 nil
1022 (let ((target (first (erc-response.command-args parsed)))
1023 (chnl (erc-response.contents parsed)))
1024 (multiple-value-bind (nick login host)
1025 (erc-parse-user (erc-response.sender parsed))
1026 (setq erc-invitation chnl)
1027 (when (string= target (erc-current-nick))
1028 (erc-display-message
1029 parsed 'notice 'active
1030 'INVITE ?n nick ?u login ?h host ?c chnl)))))
1031
1032
1033(define-erc-response-handler (JOIN)
1034 "Handle join messages."
1035 nil
1036 (let ((chnl (erc-response.contents parsed))
1037 (buffer nil))
1038 (multiple-value-bind (nick login host)
1039 (erc-parse-user (erc-response.sender parsed))
1040 ;; strip the stupid combined JOIN facility (IRC 2.9)
1041 (if (string-match "^\\(.*\\)?\^g.*$" chnl)
1042 (setq chnl (match-string 1 chnl)))
1043 (save-excursion
1044 (let* ((str (cond
1045 ;; If I have joined a channel
1046 ((erc-current-nick-p nick)
1047 (setq buffer (erc erc-session-server erc-session-port
1048 nick erc-session-user-full-name
1049 nil nil
1050 erc-default-recipients chnl
1051 erc-server-process))
1052 (when buffer
1053 (set-buffer buffer)
1054 (erc-add-default-channel chnl)
1055 (erc-server-send (format "MODE %s" chnl)))
1056 (erc-with-buffer (chnl proc)
1057 (erc-channel-begin-receiving-names))
1058 (erc-update-mode-line)
1059 (run-hooks 'erc-join-hook)
1060 (erc-make-notice
1061 (erc-format-message 'JOIN-you ?c chnl)))
1062 (t
1063 (setq buffer (erc-get-buffer chnl proc))
1064 (erc-make-notice
1065 (erc-format-message
1066 'JOIN ?n nick ?u login ?h host ?c chnl))))))
1067 (when buffer (set-buffer buffer))
1068 (erc-update-channel-member chnl nick nick t nil nil host login)
1069 ;; on join, we want to stay in the new channel buffer
1070 ;;(set-buffer ob)
1071 (erc-display-message parsed nil buffer str))))))
1072
1073(define-erc-response-handler (KICK)
1074 "Handle kick messages received from the server." nil
1075 (let* ((ch (first (erc-response.command-args parsed)))
1076 (tgt (second (erc-response.command-args parsed)))
1077 (reason (erc-trim-string (erc-response.contents parsed)))
1078 (buffer (erc-get-buffer ch proc)))
1079 (multiple-value-bind (nick login host)
1080 (erc-parse-user (erc-response.sender parsed))
1081 (erc-remove-channel-member buffer tgt)
1082 (cond
1083 ((string= tgt (erc-current-nick))
1084 (erc-display-message
1085 parsed 'notice buffer
1086 'KICK-you ?n nick ?u login ?h host ?c ch ?r reason)
1087 (run-hook-with-args 'erc-kick-hook buffer)
1088 (erc-with-buffer
1089 (buffer)
1090 (erc-remove-channel-users))
1091 (erc-delete-default-channel ch buffer)
1092 (erc-update-mode-line buffer))
1093 ((string= nick (erc-current-nick))
1094 (erc-display-message
1095 parsed 'notice buffer
1096 'KICK-by-you ?k tgt ?c ch ?r reason))
1097 (t (erc-display-message
1098 parsed 'notice buffer
1099 'KICK ?k tgt ?n nick ?u login ?h host ?c ch ?r reason))))))
1100
1101(define-erc-response-handler (MODE)
1102 "Handle server mode changes." nil
1103 (let ((tgt (first (erc-response.command-args parsed)))
1104 (mode (mapconcat 'identity (cdr (erc-response.command-args parsed))
1105 " ")))
1106 (multiple-value-bind (nick login host)
1107 (erc-parse-user (erc-response.sender parsed))
1108 (erc-log (format "MODE: %s -> %s: %s" nick tgt mode))
1109 ;; dirty hack
1110 (let ((buf (cond ((erc-channel-p tgt)
1111 (erc-get-buffer tgt proc))
1112 ((string= tgt (erc-current-nick)) nil)
1113 ((erc-active-buffer) (erc-active-buffer))
1114 (t (erc-get-buffer tgt)))))
1115 (with-current-buffer (or buf
1116 (current-buffer))
1117 (erc-update-modes tgt mode nick host login))
1118 (if (or (string= login "") (string= host ""))
1119 (erc-display-message parsed 'notice buf
1120 'MODE-nick ?n nick
1121 ?t tgt ?m mode)
1122 (erc-display-message parsed 'notice buf
1123 'MODE ?n nick ?u login
1124 ?h host ?t tgt ?m mode)))
1125 (erc-banlist-update proc parsed))))
1126
1127(define-erc-response-handler (NICK)
1128 "Handle nick change messages." nil
1129 (let ((nn (erc-response.contents parsed))
1130 bufs)
1131 (multiple-value-bind (nick login host)
1132 (erc-parse-user (erc-response.sender parsed))
1133 (setq bufs (erc-buffer-list-with-nick nick proc))
1134 (erc-log (format "NICK: %s -> %s" nick nn))
1135 ;; if we had a query with this user, make sure future messages will be
1136 ;; sent to the correct nick. also add to bufs, since the user will want
1137 ;; to see the nick change in the query, and if it's a newly begun query,
1138 ;; erc-channel-users won't contain it
1139 (erc-buffer-filter
1140 (lambda ()
1141 (when (equal (erc-default-target) nick)
1142 (setq erc-default-recipients
1143 (cons nn (cdr erc-default-recipients)))
1144 (rename-buffer nn)
1145 (erc-update-mode-line)
1146 (add-to-list 'bufs (current-buffer)))))
1147 (erc-update-user-nick nick nn host nil nil login)
1148 (cond
1149 ((string= nick (erc-current-nick))
1150 (add-to-list 'bufs (erc-server-buffer))
1151 (erc-set-current-nick nn)
1152 (erc-update-mode-line)
1153 (setq erc-nick-change-attempt-count 0)
1154 (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
1155 (erc-display-message
1156 parsed 'notice bufs
1157 'NICK-you ?n nick ?N nn)
1158 (run-hook-with-args 'erc-nick-changed-functions nn nick))
1159 (t
1160 (erc-handle-user-status-change 'nick (list nick login host) (list nn))
1161 (erc-display-message parsed 'notice bufs 'NICK ?n nick
1162 ?u login ?h host ?N nn))))))
1163
1164(define-erc-response-handler (PART)
1165 "Handle part messages." nil
1166 (let* ((chnl (first (erc-response.command-args parsed)))
1167 (reason (erc-trim-string (erc-response.contents parsed)))
1168 (buffer (erc-get-buffer chnl proc)))
1169 (multiple-value-bind (nick login host)
1170 (erc-parse-user (erc-response.sender parsed))
1171 (erc-remove-channel-member buffer nick)
1172 (erc-display-message parsed 'notice buffer
1173 'PART ?n nick ?u login
1174 ?h host ?c chnl ?r (or reason ""))
1175 (when (string= nick (erc-current-nick))
1176 (run-hook-with-args 'erc-part-hook buffer)
1177 (erc-with-buffer
1178 (buffer)
1179 (erc-remove-channel-users))
1180 (erc-delete-default-channel chnl buffer)
1181 (erc-update-mode-line buffer)
1182 (when erc-kill-buffer-on-part
1183 (kill-buffer buffer))))))
1184
1185(define-erc-response-handler (PING)
1186 "Handle ping messages." nil
1187 (let ((pinger (first (erc-response.command-args parsed))))
1188 (erc-log (format "PING: %s" pinger))
1189 ;; ping response to the server MUST be forced, or you can lose big
1190 (erc-server-send (format "PONG :%s" pinger) t)
1191 (when erc-verbose-server-ping
1192 (erc-display-message
1193 parsed 'error proc
1194 'PING ?s (erc-time-diff erc-server-last-ping-time (erc-current-time))))
1195 (setq erc-server-last-ping-time (erc-current-time))))
1196
1197(define-erc-response-handler (PONG)
1198 "Handle pong messages." nil
1199 (let ((time (string-to-number (erc-response.contents parsed))))
1200 (when (> time 0)
1201 (setq erc-server-lag (erc-time-diff time (erc-current-time)))
1202 (when erc-verbose-server-ping
1203 (erc-display-message
1204 parsed 'notice proc 'PONG
1205 ?h (first (erc-response.command-args parsed)) ?i erc-server-lag
1206 ?s (if (/= erc-server-lag 1) "s" "")))
1207 (erc-update-mode-line))))
1208
1209(define-erc-response-handler (PRIVMSG NOTICE)
1210 nil nil
1211 (let ((sender-spec (erc-response.sender parsed))
1212 (cmd (erc-response.command parsed))
1213 (tgt (car (erc-response.command-args parsed)))
1214 (msg (erc-response.contents parsed)))
1215 (if (or (erc-ignored-user-p sender-spec)
1216 (erc-ignored-reply-p msg tgt proc))
1217 (when erc-minibuffer-ignored
1218 (message "Ignored %s from %s to %s" cmd sender-spec tgt))
1219 (let* ((sndr (erc-parse-user sender-spec))
1220 (nick (nth 0 sndr))
1221 (login (nth 1 sndr))
1222 (host (nth 2 sndr))
1223 (msgp (string= cmd "PRIVMSG"))
1224 (noticep (string= cmd "NOTICE"))
1225 ;; S.B. downcase *both* tgt and current nick
1226 (privp (erc-current-nick-p tgt))
1227 s buffer
1228 fnick)
1229 (setf (erc-response.contents parsed) msg)
1230 (setq buffer (erc-get-buffer (if privp nick tgt) proc))
1231 (when buffer
1232 (with-current-buffer buffer
1233 ;; update the chat partner info. Add to the list if private
1234 ;; message. We will accumulate private identities indefinitely
1235 ;; at this point.
1236 (erc-update-channel-member (if privp nick tgt) nick nick
1237 privp nil nil host login nil nil t)
1238 (let ((cdata (erc-get-channel-user nick)))
1239 (setq fnick (funcall erc-format-nick-function
1240 (car cdata) (cdr cdata))))))
1241 (cond
1242 ((erc-is-message-ctcp-p msg)
1243 (setq s (if msgp
1244 (erc-process-ctcp-query proc parsed nick login host)
1245 (erc-process-ctcp-reply proc parsed nick login host
1246 (match-string 1 msg)))))
1247 (t
1248 (setcar erc-server-last-peers nick)
1249 (setq s (erc-format-privmessage
1250 (or fnick nick) msg
1251 ;; If buffer is a query buffer,
1252 ;; format the nick as for a channel.
1253 (and (not (and buffer
1254 (erc-query-buffer-p buffer)
1255 erc-format-query-as-channel-p))
1256 privp)
1257 msgp))))
1258 (when s
1259 (if (and noticep privp)
1260 (progn
1261 (run-hook-with-args 'erc-echo-notice-always-hook
1262 s parsed buffer nick)
1263 (run-hook-with-args-until-success
1264 'erc-echo-notice-hook s parsed buffer nick))
1265 (erc-display-message parsed nil buffer s)))
1266 (when (string= cmd "PRIVMSG")
1267 (erc-auto-query proc parsed))))))
1268
1269;; FIXME: need clean way of specifiying extra hooks in
1270;; define-erc-response-handler.
1271(add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query)
1272
1273(define-erc-response-handler (QUIT)
1274 nil nil
1275 (let ((reason (erc-response.contents parsed))
1276 bufs)
1277 (multiple-value-bind (nick login host)
1278 (erc-parse-user (erc-response.sender parsed))
1279 (setq bufs (erc-buffer-list-with-nick nick proc))
1280 (erc-remove-user nick)
1281 (setq reason (erc-wash-quit-reason reason nick login host))
1282 (erc-display-message parsed 'notice bufs
1283 'QUIT ?n nick ?u login
1284 ?h host ?r reason))))
1285
1286(define-erc-response-handler (TOPIC)
1287 nil nil
1288 (let* ((ch (first (erc-response.command-args parsed)))
1289 (topic (erc-trim-string (erc-response.contents parsed)))
1290 (time (format-time-string "%T %m/%d/%y" (current-time))))
1291 (multiple-value-bind (nick login host)
1292 (erc-parse-user (erc-response.sender parsed))
1293 (erc-update-channel-member ch nick nick nil nil nil host login)
1294 (erc-update-channel-topic ch (format "%s\C-o (%s, %s)" topic nick time))
1295 (erc-display-message parsed 'notice (erc-get-buffer ch proc)
1296 'TOPIC ?n nick ?u login ?h host
1297 ?c ch ?T topic))))
1298
1299(define-erc-response-handler (WALLOPS)
1300 nil nil
1301 (let ((message (erc-response.contents parsed)))
1302 (multiple-value-bind (nick login host)
1303 (erc-parse-user (erc-response.sender parsed))
1304 (erc-display-message
1305 parsed 'notice nil
1306 'WALLOPS ?n nick ?m message))))
1307
1308(define-erc-response-handler (001)
1309 "Set `erc-server-current-nick' to reflect server settings and display the welcome message."
1310 nil
1311 (erc-set-current-nick (first (erc-response.command-args parsed)))
1312 (erc-update-mode-line) ; needed here?
1313 (setq erc-nick-change-attempt-count 0)
1314 (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
1315 (erc-display-message
1316 parsed 'notice 'active (erc-response.contents parsed)))
1317
1318(define-erc-response-handler (MOTD 002 003 371 372 374 375)
1319 "Display the server's message of the day." nil
1320 (erc-handle-login)
1321 (erc-display-message
1322 parsed 'notice (if erc-server-connected 'active proc)
1323 (erc-response.contents parsed)))
1324
1325(define-erc-response-handler (376 422)
1326 nil nil
1327 (erc-server-MOTD proc parsed)
1328 (erc-connection-established proc parsed))
1329
1330(define-erc-response-handler (004)
1331 nil nil
1332 (multiple-value-bind (server-name server-version)
1333 (cdr (erc-response.command-args parsed))
1334 (setq erc-server-version server-version)
1335 (setq erc-server-announced-name server-name)
1336 (erc-update-mode-line-buffer (process-buffer proc))
1337 (erc-display-message
1338 parsed 'notice proc
1339 's004 ?s server-name ?v server-version
1340 ?U (fourth (erc-response.command-args parsed))
1341 ?C (fifth (erc-response.command-args parsed)))))
1342
1343(define-erc-response-handler (005)
1344 "Set the variable `erc-server-parameters' and display the received message.
1345
1346According to RFC 2812, suggests alternate servers on the network.
1347Many servers, however, use this code to show which parameters they have set,
1348for example, the network identifier, maximum allowed topic length, whether
1349certain commands are accepted and more. See documentation for
1350`erc-server-parameters' for more information on the parameters sent.
1351
1352A server may send more than one 005 message."
1353 nil
1354 (let ((line (mapconcat 'identity
1355 (setf (erc-response.command-args parsed)
1356 (cdr (erc-response.command-args parsed)))
1357 " ")))
1358 (while (erc-response.command-args parsed)
1359 (let ((section (pop (erc-response.command-args parsed))))
1360 ;; fill erc-server-parameters
1361 (when (string-match "^\\([A-Z]+\\)\=\\(.*\\)$\\|^\\([A-Z]+\\)$"
1362 section)
1363 (add-to-list 'erc-server-parameters
1364 `(,(or (match-string 1 section)
1365 (match-string 3 section))
1366 .
1367 ,(match-string 2 section))))))
1368 (erc-display-message parsed 'notice proc line)))
1369
1370(define-erc-response-handler (221)
1371 nil nil
1372 (let* ((nick (first (erc-response.command-args parsed)))
1373 (modes (mapconcat 'identity
1374 (cdr (erc-response.command-args parsed)) " ")))
1375 (erc-set-modes nick modes)
1376 (erc-display-message parsed 'notice 'active 's221 ?n nick ?m modes)))
1377
1378(define-erc-response-handler (252)
1379 "Display the number of IRC operators online." nil
1380 (erc-display-message parsed 'notice 'active 's252
1381 ?i (second (erc-response.command-args parsed))))
1382
1383(define-erc-response-handler (253)
1384 "Display the number of unknown connections." nil
1385 (erc-display-message parsed 'notice 'active 's253
1386 ?i (second (erc-response.command-args parsed))))
1387
1388(define-erc-response-handler (254)
1389 "Display the number of channels formed." nil
1390 (erc-display-message parsed 'notice 'active 's254
1391 ?i (second (erc-response.command-args parsed))))
1392
1393(define-erc-response-handler (250 251 255 256 257 258 259 265 266 377 378)
1394 "Generic display of server messages as notices.
1395
1396See `erc-display-server-message'." nil
1397 (erc-display-server-message proc parsed))
1398
1399(define-erc-response-handler (301)
1400 "AWAY notice." nil
1401 (erc-display-message parsed 'notice 'active 's301
1402 ?n (second (erc-response.command-args parsed))
1403 ?r (erc-response.contents parsed)))
1404
1405(define-erc-response-handler (303)
1406 "ISON reply" nil
1407 (erc-display-message parsed 'notice 'active 's303
1408 ?n (second (erc-response.command-args parsed))))
1409
1410(define-erc-response-handler (305)
1411 "Return from AWAYness." nil
1412 (erc-process-away proc nil)
1413 (erc-display-message parsed 'notice 'active
1414 's305 ?m (erc-response.contents parsed)))
1415
1416(define-erc-response-handler (306)
1417 "Set AWAYness." nil
1418 (erc-process-away proc t)
1419 (erc-display-message parsed 'notice 'active
1420 's306 ?m (erc-response.contents parsed)))
1421
1422(define-erc-response-handler (311 314)
1423 "WHOIS/WHOWAS notices." nil
1424 (let ((fname (erc-response.contents parsed))
1425 (catalog-entry (intern (format "s%s" (erc-response.command parsed)))))
1426 (multiple-value-bind (nick user host)
1427 (cdr (erc-response.command-args parsed))
1428 (erc-update-user-nick nick nick host nil fname user)
1429 (erc-display-message
1430 parsed 'notice 'active catalog-entry
1431 ?n nick ?f fname ?u user ?h host))))
1432
1433(define-erc-response-handler (312)
1434 nil nil
1435 (multiple-value-bind (nick server-host)
1436 (cdr (erc-response.command-args parsed))
1437 (erc-display-message
1438 parsed 'notice 'active 's312
1439 ?n nick ?s server-host ?c (erc-response.contents parsed))))
1440
1441(define-erc-response-handler (313)
1442 "IRC Operator response in WHOIS." nil
1443 (erc-display-message
1444 parsed 'notice 'active 's313
1445 ?n (second (erc-response.command-args parsed))))
1446
1447(define-erc-response-handler (315 318 323 369)
1448 ;; 315 - End of WHO
1449 ;; 318 - End of WHOIS list
1450 ;; 323 - End of channel LIST
1451 ;; 369 - End of WHOWAS
1452 nil nil
1453 (ignore proc parsed))
1454
1455(define-erc-response-handler (317)
1456 "IDLE notice." nil
1457 (multiple-value-bind (nick seconds-idle on-since time)
1458 (cdr (erc-response.command-args parsed))
1459 (setq time (when on-since
1460 (format-time-string "%T %Y/%m/%d"
1461 (erc-string-to-emacs-time on-since))))
1462 (erc-update-user-nick nick nick nil nil nil
1463 (and time (format "on since %s" time)))
1464 (if time
1465 (erc-display-message
1466 parsed 'notice 'active 's317-on-since
1467 ?n nick ?i (erc-sec-to-time (string-to-number seconds-idle)) ?t time)
1468 (erc-display-message
1469 parsed 'notice 'active 's317
1470 ?n nick ?i (erc-sec-to-time (string-to-number seconds-idle))))))
1471
1472(define-erc-response-handler (319)
1473 nil nil
1474 (erc-display-message
1475 parsed 'notice 'active 's319
1476 ?n (second (erc-response.command-args parsed))
1477 ?c (erc-response.contents parsed)))
1478
1479(define-erc-response-handler (320)
1480 "Identified user in WHOIS." nil
1481 (erc-display-message
1482 parsed 'notice 'active 's320
1483 ?n (second (erc-response.command-args parsed))))
1484
1485(define-erc-response-handler (321)
1486 "LIST header." nil
1487 (setq erc-channel-list nil)
1488 (erc-display-message parsed 'notice 'active 's321))
1489
1490(define-erc-response-handler (322)
1491 "LIST notice." nil
1492 (let ((topic (erc-response.contents parsed)))
1493 (multiple-value-bind (channel num-users)
1494 (cdr (erc-response.command-args parsed))
1495 (add-to-list 'erc-channel-list (list channel))
1496 (erc-update-channel-topic channel topic)
1497 (erc-display-message
1498 parsed 'notice 'active 's322
1499 ?c channel ?u num-users ?t (or topic "")))))
1500
1501(define-erc-response-handler (324)
1502 "Channel or nick modes." nil
1503 (let ((channel (second (erc-response.command-args parsed)))
1504 (modes (mapconcat 'identity (cddr (erc-response.command-args parsed))
1505 " ")))
1506 (erc-set-modes channel modes)
1507 (erc-display-message
1508 parsed 'notice (erc-get-buffer channel proc)
1509 's324 ?c channel ?m modes)))
1510
1511(define-erc-response-handler (329)
1512 "Channel creation date." nil
1513 (let ((channel (second (erc-response.command-args parsed)))
1514 (time (erc-string-to-emacs-time
1515 (third (erc-response.command-args parsed)))))
1516 (erc-display-message
1517 parsed 'notice (erc-get-buffer channel proc)
1518 's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time))))
1519
1520(define-erc-response-handler (330)
1521 nil nil
1522 ;; FIXME: I don't know what the magic numbers mean. Mummy, make
1523 ;; the magic numbers go away.
1524 ;; No seriously, I have no clue about the format of this command,
1525 ;; and don't sit on Quakenet, so can't test. Originally we had:
1526 ;; nick == (aref parsed 3)
1527 ;; authaccount == (aref parsed 4)
1528 ;; authmsg == (aref parsed 5)
1529 ;; The guesses below are, well, just that. -- Lawrence 2004/05/10
1530 (let ((nick (second (erc-response.command-args parsed)))
1531 (authaccount (third (erc-response.command-args parsed)))
1532 (authmsg (erc-response.contents parsed)))
1533 (erc-display-message parsed 'notice 'active 's330
1534 ?n nick ?a authmsg ?i authaccount)))
1535
1536(define-erc-response-handler (331)
1537 "Channel topic." nil
1538 (let ((channel (second (erc-response.command-args parsed)))
1539 (topic (erc-response.contents parsed)))
1540 ;; FIXME: why don't we do anything with the topic? -- Lawrence 2004/05/10
1541 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1542 's331 ?c channel)))
1543
1544(define-erc-response-handler (332)
1545 "TOPIC notice." nil
1546 (let ((channel (second (erc-response.command-args parsed)))
1547 (topic (erc-response.contents parsed)))
1548 (erc-update-channel-topic channel topic)
1549 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1550 's332 ?c channel ?T topic)))
1551
1552(define-erc-response-handler (333)
1553 ;; Who set the topic, and when
1554 nil nil
1555 (multiple-value-bind (channel nick time)
1556 (cdr (erc-response.command-args parsed))
1557 (setq time (format-time-string "%T %Y/%m/%d"
1558 (erc-string-to-emacs-time time)))
1559 (erc-update-channel-topic channel
1560 (format "\C-o (%s, %s)" nick time)
1561 'append)
1562 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1563 's333 ?c channel ?n nick ?t time)))
1564
1565(define-erc-response-handler (341)
1566 "Let user know when an INVITE attempt has been sent successfully."
1567 nil
1568 (multiple-value-bind (nick channel)
1569 (cdr (erc-response.command-args parsed))
1570 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1571 's341 ?n nick ?c channel)))
1572
1573(define-erc-response-handler (352)
1574 "WHO notice." nil
1575 (multiple-value-bind (channel user host server nick away-flag)
1576 (cdr (erc-response.command-args parsed))
1577 (let ((full-name (erc-response.contents parsed))
1578 hopcount)
1579 (when (string-match "\\(^[0-9]+ \\)\\(.*\\)$" full-name)
1580 (setq hopcount (match-string 1 full-name))
1581 (setq full-name (match-string 2 full-name)))
1582 (erc-update-channel-member channel nick nick nil nil nil host
1583 user full-name)
1584 (erc-display-message parsed 'notice 'active 's352
1585 ?c channel ?n nick ?a away-flag
1586 ?u user ?h host ?f full-name))))
1587
1588(define-erc-response-handler (353)
1589 "NAMES notice." nil
1590 (let ((channel (third (erc-response.command-args parsed)))
1591 (users (erc-response.contents parsed)))
1592 (erc-with-buffer (channel proc)
1593 (erc-channel-receive-names users))
1594 (erc-display-message parsed 'notice (or (erc-get-buffer channel proc)
1595 'active)
1596 's353 ?c channel ?u users)))
1597
1598(define-erc-response-handler (366)
1599 "End of NAMES." nil
1600 (erc-with-buffer ((second (erc-response.command-args parsed)) proc)
1601 (erc-channel-end-receiving-names)))
1602
1603(define-erc-response-handler (367)
1604 "Channel ban list entries" nil
1605 (multiple-value-bind (channel banmask setter time)
1606 (cdr (erc-response.command-args parsed))
1607 (erc-display-message parsed 'notice 'active 's367
1608 ?c channel
1609 ?b banmask
1610 ?s setter
1611 ?t time)))
1612
1613(define-erc-response-handler (368)
1614 "End of channel ban list" nil
1615 (let ((channel (second (erc-response.command-args parsed))))
1616 (erc-display-message parsed 'notice 'active 's368
1617 ?c channel)))
1618
1619(define-erc-response-handler (379)
1620 "Forwarding to another channel." nil
1621 ;; FIXME: Yet more magic numbers in original code, I'm guessing this
1622 ;; command takes two arguments, and doesn't have any "contents". --
1623 ;; Lawrence 2004/05/10
1624 (multiple-value-bind (from to)
1625 (cdr (erc-response.command-args parsed))
1626 (erc-display-message parsed 'notice 'active
1627 's379 ?c from ?f to)))
1628
1629(define-erc-response-handler (391)
1630 "Server's time string" nil
1631 (erc-display-message
1632 parsed 'notice 'active
1633 's391 ?s (second (erc-response.command-args parsed))
1634 ?t (third (erc-response.command-args parsed))))
1635
1636(define-erc-response-handler (401)
1637 "No such nick/channel." nil
1638 (let ((nick/channel (second (erc-response.command-args parsed))))
1639 (when erc-whowas-on-nosuchnick
1640 (erc-log (format "cmd: WHOWAS: %s" nick/channel))
1641 (erc-server-send (format "WHOWAS %s 1" nick/channel)))
1642 (erc-display-message parsed '(notice error) 'active
1643 's401 ?n nick/channel)))
1644
1645(define-erc-response-handler (403)
1646 "No such channel." nil
1647 (erc-display-message parsed '(notice error) 'active
1648 's403 ?c (second (erc-response.command-args parsed))))
1649
1650(define-erc-response-handler (404)
1651 "Cannot send to channel." nil
1652 (erc-display-message parsed '(notice error) 'active
1653 's404 ?c (second (erc-response.command-args parsed))))
1654
1655
1656(define-erc-response-handler (405)
1657 ;; Can't join that many channels.
1658 nil nil
1659 (erc-display-message parsed '(notice error) 'active
1660 's405 ?c (second (erc-response.command-args parsed))))
1661
1662(define-erc-response-handler (406)
1663 ;; No such nick
1664 nil nil
1665 (erc-display-message parsed '(notice error) 'active
1666 's406 ?n (second (erc-response.command-args parsed))))
1667
1668(define-erc-response-handler (412)
1669 ;; No text to send
1670 nil nil
1671 (erc-display-message parsed '(notice error) 'active 's412))
1672
1673(define-erc-response-handler (421)
1674 ;; Unknown command
1675 nil nil
1676 (erc-display-message parsed '(notice error) 'active 's421
1677 ?c (second (erc-response.command-args parsed))))
1678
1679(define-erc-response-handler (432)
1680 ;; Bad nick.
1681 nil nil
1682 (erc-display-message parsed '(notice error) 'active 's432
1683 ?n (second (erc-response.command-args parsed))))
1684
1685(define-erc-response-handler (433)
1686 ;; Login-time "nick in use"
1687 nil nil
1688 (erc-nickname-in-use (second (erc-response.command-args parsed))
1689 "already in use"))
1690
1691(define-erc-response-handler (437)
1692 ;; Nick temporarily unavailable (IRCnet)
1693 nil nil
1694 (let ((nick/channel (second (erc-response.command-args parsed))))
1695 (unless (erc-channel-p nick/channel)
1696 (erc-nickname-in-use nick/channel "temporarily unavailable"))))
1697
1698(define-erc-response-handler (442)
1699 ;; Not on channel
1700 nil nil
1701 (erc-display-message parsed '(notice error) 'active 's442
1702 ?c (second (erc-response.command-args parsed))))
1703
1704(define-erc-response-handler (461)
1705 ;; Not enough params for command.
1706 nil nil
1707 (erc-display-message parsed '(notice error) 'active 's461
1708 ?c (second (erc-response.command-args parsed))
1709 ?m (erc-response.contents parsed)))
1710
1711(define-erc-response-handler (474)
1712 "Banned from channel errors" nil
1713 (erc-display-message parsed '(notice error) nil
1714 (intern (format "s%s"
1715 (erc-response.command parsed)))
1716 ?c (second (erc-response.command-args parsed))))
1717
1718(define-erc-response-handler (475)
1719 "Channel key needed." nil
1720 (erc-display-message parsed '(notice error) nil 's475
1721 ?c (second (erc-response.command-args parsed)))
1722 (when erc-prompt-for-channel-key
1723 (let ((channel (second (erc-response.command-args parsed)))
1724 (key (read-from-minibuffer
1725 (format "Channel %s is mode +k. Enter key (RET to cancel): "
1726 (second (erc-response.command-args parsed))))))
1727 (when (and key (> (length key) 0))
1728 (erc-cmd-JOIN channel key)))))
1729
1730(define-erc-response-handler (477)
1731 nil nil
1732 (let ((channel (second (erc-response.command-args parsed)))
1733 (message (erc-response.contents parsed)))
1734 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1735 (format "%s: %s" channel message))))
1736
1737(define-erc-response-handler (482)
1738 nil nil
1739 (let ((channel (second (erc-response.command-args parsed)))
1740 (message (erc-response.contents parsed)))
1741 (erc-display-message parsed '(error notice) 'active 's482
1742 ?c channel ?m message)))
1743
1744(define-erc-response-handler (431 445 446 451 462 463 464 465 481 483 484 485
1745 491 501 502)
1746 ;; 431 - No nickname given
1747 ;; 445 - SUMMON has been disabled
1748 ;; 446 - USERS has been disabled
1749 ;; 451 - You have not registered
1750 ;; 462 - Unauthorized command (already registered)
1751 ;; 463 - Your host isn't among the privileged
1752 ;; 464 - Password incorrect
1753 ;; 465 - You are banned from this server
1754 ;; 481 - Need IRCop privileges
1755 ;; 483 - You can't kill a server!
1756 ;; 484 - Your connection is restricted!
1757 ;; 485 - You're not the original channel operator
1758 ;; 491 - No O-lines for your host
1759 ;; 501 - Unknown MODE flag
1760 ;; 502 - Cannot change mode for other users
1761 nil nil
1762 (erc-display-error-notice
1763 parsed
1764 (intern (format "s%s" (erc-response.command parsed)))))
1765
1766;; FIXME: These are yet to be implemented, they're just stubs for now
1767;; -- Lawrence 2004/05/12
1768
1769;; response numbers left here for reference
1770
1771;; (define-erc-response-handler (323 364 365 381 382 392 393 394 395
1772;; 200 201 202 203 204 205 206 208 209 211 212 213
1773;; 214 215 216 217 218 219 241 242 243 244 249 261
1774;; 262 302 342 351 402 407 409 411 413 414 415
1775;; 423 424 436 441 443 444 467 471 472 473 KILL)
1776;; nil nil
1777;; (ignore proc parsed))
1778
1779(provide 'erc-backend)
1780
1781;;; erc-backend.el ends here
1782;; Local Variables:
1783;; indent-tabs-mode: nil
1784;; End:
1785
1786;; arch-tag: a64e6bb7-a780-4efd-8f98-083b18c7c84a
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
new file mode 100644
index 00000000000..6c6998a3afc
--- /dev/null
+++ b/lisp/erc/erc-button.el
@@ -0,0 +1,504 @@
1;; erc-button.el --- A way of buttonizing certain things in ERC buffers
2
3;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4;; 2006 Free Software Foundation, Inc.
5
6;; Author: Mario Lang <mlang@delysid.org>
7;; Keywords: irc, button, url, regexp
8;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcButton
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28
29;; Heavily borrowed from gnus-art.el. Thanks to the original authors.
30;; This buttonizes nicks and other stuff to make it all clickable.
31;; To enable, add to your ~/.emacs:
32;; (require 'erc-button)
33;; (erc-button-mode 1)
34;;
35;; Todo:
36;; * Rewrite all this to do the same, but use button.el from GNU Emacs
37;; if it's available for xemacs too. Why? button.el is much faster,
38;; and much more elegant, and solves the problem we get with large buffers
39;; and a large erc-button-marker-list.
40
41
42;;; Code:
43
44(require 'erc)
45(require 'wid-edit)
46(require 'erc-fill)
47
48;;; Minor Mode
49
50(defgroup erc-button nil
51 "Define how text can be turned into clickable buttons."
52 :group 'erc)
53
54;;;###autoload (autoload 'erc-button-mode "erc-button" nil t)
55(define-erc-module button nil
56 "This mode buttonizes all messages according to `erc-button-alist'."
57 ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append)
58 (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append)
59 (add-hook 'erc-complete-functions 'erc-button-next))
60 ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons)
61 (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons)
62 (remove-hook 'erc-complete-functions 'erc-button-next)))
63
64;; Make XEmacs use `erc-button-face'.
65(when (featurep 'xemacs)
66 (add-hook 'erc-mode-hook
67 (lambda () (set (make-local-variable 'widget-button-face) nil))))
68
69;;; Variables
70
71(defface erc-button '((t (:bold t)))
72 "ERC button face."
73 :group 'erc-faces)
74
75(defcustom erc-button-face 'erc-button
76 "Face used for highlighting buttons in ERC buffers.
77
78A button is a piece of text that you can activate by pressing
79`RET' or `mouse-2' above it. See also `erc-button-keymap'."
80 :type 'face
81 :group 'erc-faces)
82
83(defcustom erc-button-nickname-face 'erc-nick-default-face
84 "Face used for ERC nickname buttons."
85 :type 'face
86 :group 'erc-faces)
87
88(defcustom erc-button-mouse-face 'highlight
89 "Face used for mouse highlighting in ERC buffers.
90
91Buttons will be displayed in this face when the mouse cursor is
92above them."
93 :type 'face
94 :group 'erc-faces)
95
96(defcustom erc-button-url-regexp
97 (concat "\\(www\\.\\|\\(s?https?\\|"
98 "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)"
99 "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?"
100 "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,]+[-a-zA-Z0-9_=#$@~`%&*+\\/]")
101 "Regular expression that matches URLs."
102 :group 'erc-button
103 :type 'regexp)
104
105(defcustom erc-button-wrap-long-urls nil
106 "If non-nil, \"long\" URLs matching `erc-button-url-regexp' will be wrapped.
107
108If this variable is a number, consider URLs longer than its value to
109be \"long\". If t, URLs will be considered \"long\" if they are
110longer than `erc-fill-column'."
111 :group 'erc-button
112 :type '(choice integer boolean))
113
114(defcustom erc-button-buttonize-nicks t
115 "Flag indicating whether nicks should be buttonized or not."
116 :group 'erc-button
117 :type 'boolean)
118
119(defcustom erc-button-rfc-url "http://www.faqs.org/rfcs/rfc%s.html"
120 "*URL used to browse rfc references.
121%s is replaced by the number."
122 :group 'erc-button
123 :type 'string)
124
125(defcustom erc-button-google-url "http://www.google.com/search?q=%s"
126 "*URL used to browse Google search references.
127%s is replaced by the search string."
128 :group 'erc-button
129 :type 'string)
130
131(defcustom erc-button-alist
132 ;; Since the callback is only executed when the user is clicking on
133 ;; a button, it makes no sense to optimize performance by
134 ;; bytecompiling lambdas in this alist. On the other hand, it makes
135 ;; things hard to maintain.
136 '(('nicknames 0 erc-button-buttonize-nicks erc-nick-popup 0)
137 (erc-button-url-regexp 0 t browse-url 0)
138 ("<URL: *\\([^<> ]+\\) *>" 0 t browse-url 1)
139 ("(\\(\\([^~\n \t@][^\n \t@]*\\)@\\([a-zA-Z0-9.:-]+\\)\\)" 1 t finger 2 3)
140 ;; emacs internal
141 ("[`]\\([a-zA-Z][-a-zA-Z_0-9]+\\)[']" 1 t erc-button-describe-symbol 1)
142 ;; pseudo links
143 ("\\bInfo:[\"]\\([^\"]+\\)[\"]" 0 t Info-goto-node 1)
144 ("\\b\\(Ward\\|Wiki\\|WardsWiki\\|TheWiki\\):\\([A-Z][a-z]+\\([A-Z][a-z]+\\)+\\)"
145 0 t (lambda (page)
146 (browse-url (concat "http://c2.com/cgi-bin/wiki?" page)))
147 2)
148 ("EmacsWiki:\\([A-Z][a-z]+\\([A-Z][a-z]+\\)+\\)" 0 t erc-browse-emacswiki 1)
149 ("Lisp:\\([a-zA-Z.+-]+\\)" 0 t erc-browse-emacswiki-lisp 1)
150 ("\\bGoogle:\\([^ \t\n\r\f]+\\)"
151 0 t (lambda (keywords)
152 (browse-url (format erc-button-google-url keywords)))
153 1)
154 ("\\brfc[#: ]?\\([0-9]+\\)"
155 0 t (lambda (num)
156 (browse-url (format erc-button-rfc-url num)))
157 1)
158 ;; other
159 ("\\s-\\(@\\([0-9][0-9][0-9]\\)\\)" 1 t erc-button-beats-to-time 2))
160 "*Alist of regexps matching buttons in ERC buffers.
161Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
162
163REGEXP is the string matching text around the button or a symbol
164 indicating a variable holding that string, or a list of
165 strings, or an alist with the strings in the car. Note that
166 entries in lists or alists are considered to be nicks or other
167 complete words. Therefore they are enclosed in \\< and \\>
168 while searching. REGEXP can also be the quoted symbol
169 'nicknames, which matches the nickname of any user on the
170 current server.
171
172BUTTON is the number of the regexp grouping actually matching the
173 button, This is ignored if REGEXP is 'nicknames.
174
175FORM is a lisp expression which must eval to true for the button to
176 be added,
177
178CALLBACK is the function to call when the user push this button.
179 CALLBACK can also be a symbol. Its variable value will be used
180 as the callback function.
181
182PAR is a number of a regexp grouping whose text will be passed to
183 CALLBACK. There can be several PAR arguments. If REGEXP is
184 'nicknames, these are ignored, and CALLBACK will be called with
185 the nickname matched as the argument."
186 :group 'erc-button
187 :type '(repeat
188 (list :tag "Button"
189 (choice :tag "Matches"
190 regexp
191 (variable :tag "Variable containing regexp")
192 (const :tag "Nicknames" 'nicknames))
193 (integer :tag "Number of the regexp section that matches")
194 (choice :tag "When to buttonize"
195 (const :tag "Always" t)
196 (sexp :tag "Only when this evaluates to non-nil"))
197 (function :tag "Function to call when button is pressed")
198 (repeat :tag "Sections of regexp to send to the function"
199 :inline t
200 (integer :tag "Regexp section number")))))
201
202(defcustom erc-emacswiki-url "http://www.emacswiki.org/cgi-bin/wiki.pl?"
203 "*URL of the EmacsWiki Homepage."
204 :group 'erc-button
205 :type 'string)
206
207(defcustom erc-emacswiki-lisp-url "http://www.emacswiki.org/elisp/"
208 "*URL of the EmacsWiki ELisp area."
209 :group 'erc-button
210 :type 'string)
211
212(defvar erc-button-keymap
213 (let ((map (make-sparse-keymap)))
214 (define-key map (kbd "RET") 'erc-button-press-button)
215 (if (featurep 'xemacs)
216 (define-key map (kbd "<button2>") 'erc-button-click-button)
217 (define-key map (kbd "<mouse-2>") 'erc-button-click-button))
218 (define-key map (kbd "TAB") 'erc-button-next)
219 (set-keymap-parent map erc-mode-map)
220 map)
221 "Local keymap for ERC buttons.")
222
223(defvar erc-button-syntax-table
224 (let ((table (make-syntax-table)))
225 (modify-syntax-entry ?\( "w" table)
226 (modify-syntax-entry ?\) "w" table)
227 (modify-syntax-entry ?\[ "w" table)
228 (modify-syntax-entry ?\] "w" table)
229 (modify-syntax-entry ?\{ "w" table)
230 (modify-syntax-entry ?\} "w" table)
231 (modify-syntax-entry ?` "w" table)
232 (modify-syntax-entry ?' "w" table)
233 (modify-syntax-entry ?^ "w" table)
234 (modify-syntax-entry ?- "w" table)
235 (modify-syntax-entry ?_ "w" table)
236 (modify-syntax-entry ?| "w" table)
237 (modify-syntax-entry ?\\ "w" table)
238 table)
239 "Syntax table used when buttonizing messages.
240This syntax table should make all the legal nick characters word
241constituents.")
242
243(defun erc-button-add-buttons ()
244 "Find external references in the current buffer and make buttons of them.
245\"External references\" are things like URLs, as
246specified by `erc-button-alist'."
247 (interactive)
248 (save-excursion
249 (with-syntax-table erc-button-syntax-table
250 (let ((buffer-read-only nil)
251 (inhibit-point-motion-hooks t)
252 (inhibit-field-text-motion t)
253 (alist erc-button-alist)
254 entry regexp data)
255 (erc-button-remove-old-buttons)
256 (dolist (entry alist)
257 (if (equal (car entry) (quote (quote nicknames)))
258 (erc-button-add-nickname-buttons entry)
259 (progn
260 (setq regexp (or (and (stringp (car entry)) (car entry))
261 (and (boundp (car entry))
262 (symbol-value (car entry)))))
263 (cond ((stringp regexp)
264 (erc-button-add-buttons-1 regexp entry))
265 ((and (listp regexp) (stringp (car regexp)))
266 (dolist (r regexp)
267 (erc-button-add-buttons-1
268 (concat "\\<" (regexp-quote r) "\\>")
269 entry)))
270 ((and (listp regexp) (listp (car regexp))
271 (stringp (caar regexp)))
272 (dolist (elem regexp)
273 (erc-button-add-buttons-1
274 (concat "\\<" (regexp-quote (car elem)) "\\>")
275 entry)))))))))))
276
277(defun erc-button-add-nickname-buttons (entry)
278 "Search through the buffer for nicknames, and add buttons."
279 (let ((form (nth 2 entry))
280 (fun (nth 3 entry))
281 bounds word)
282 (when (or (eq t form)
283 (eval form))
284 (goto-char (point-min))
285 (while (forward-word 1)
286 (setq bounds (bounds-of-thing-at-point 'word))
287 (setq word (buffer-substring-no-properties
288 (car bounds) (cdr bounds)))
289 (if (erc-get-server-user word)
290 (erc-button-add-button (car bounds) (cdr bounds)
291 fun t (list word)))))))
292
293(defun erc-button-add-buttons-1 (regexp entry)
294 "Search through the buffer for matches to ENTRY and add buttons."
295 (goto-char (point-min))
296 (while (re-search-forward regexp nil t)
297 (let ((start (match-beginning (nth 1 entry)))
298 (end (match-end (nth 1 entry)))
299 (form (nth 2 entry))
300 (fun (nth 3 entry))
301 (data (mapcar 'match-string (nthcdr 4 entry))))
302 (when (or (eq t form)
303 (eval form))
304 (erc-button-add-button start end fun nil data regexp)))))
305
306(defun erc-button-remove-old-buttons ()
307 "Remove all existing buttons.
308This is called with narrowing in effect, just before the text is
309buttonized again. Removing a button means to remove all the properties
310that `erc-button-add-button' adds, except for the face."
311 (remove-text-properties
312 (point-min) (point-max)
313 '(erc-callback nil
314 erc-data nil
315 mouse-face nil
316 keymap nil)))
317
318(defun erc-button-add-button (from to fun nick-p &optional data regexp)
319 "Create a button between FROM and TO with callback FUN and data DATA.
320NICK-P specifies if this is a nickname button.
321REGEXP is the regular expression which matched for this button."
322 ;; Really nasty hack to <URL: > ise urls, and line-wrap them if
323 ;; they're going to be wider than `erc-fill-column'.
324 ;; This could be a lot cleaner, but it works for me -- lawrence.
325 (let (fill-column)
326 (when (and erc-button-wrap-long-urls
327 (string= regexp erc-button-url-regexp)
328 (> (- to from)
329 (setq fill-column (- (if (numberp erc-button-wrap-long-urls)
330 erc-button-wrap-long-urls
331 erc-fill-column)
332 (length erc-fill-prefix)))))
333 (setq to (prog1 (point-marker) (insert ">"))
334 from (prog2 (goto-char from) (point-marker) (insert "<URL: ")))
335 (let ((pos (copy-marker from)))
336 (while (> (- to pos) fill-column)
337 (goto-char (+ pos fill-column))
338 (insert "\n" erc-fill-prefix) ; This ought to figure out
339 ; what type of filling we're
340 ; doing, and indent accordingly.
341 (move-marker pos (point))))))
342 (if nick-p
343 (when erc-button-nickname-face
344 (erc-button-add-face from to erc-button-nickname-face))
345 (when erc-button-face
346 (erc-button-add-face from to erc-button-face)))
347 (add-text-properties
348 from to
349 (nconc (and erc-button-mouse-face
350 (list 'mouse-face erc-button-mouse-face))
351 (list 'erc-callback fun)
352 (list 'keymap erc-button-keymap)
353 (list 'rear-nonsticky t)
354 (and data (list 'erc-data data))))
355 (widget-convert-button 'link from to :action 'erc-button-press-button
356 :suppress-face t
357 ;; Make XEmacs use our faces.
358 :button-face (if nick-p
359 erc-button-nickname-face
360 erc-button-face)
361 ;; Make XEmacs behave with mouse-clicks, for
362 ;; some reason, widget stuff overrides the
363 ;; 'keymap text-property.
364 :mouse-down-action 'erc-button-click-button))
365
366(defun erc-button-add-face (from to face)
367 "Add FACE to the region between FROM and TO."
368 ;; If we just use `add-text-property', then this will overwrite any
369 ;; face text property already used for the button. It will not be
370 ;; merged correctly. If we use overlays, then redisplay will be
371 ;; very slow with lots of buttons. This is why we manually merge
372 ;; face text properties.
373 (let ((old (erc-list (get-text-property from 'face)))
374 (pos from)
375 (end (next-single-property-change from 'face nil to))
376 new)
377 ;; old is the face at pos, in list form. It is nil if there is no
378 ;; face at pos. If nil, the new face is FACE. If not nil, the
379 ;; new face is a list containing FACE and the old stuff. end is
380 ;; where this face changes.
381 (while (< pos to)
382 (setq new (if old (cons face old) face))
383 (put-text-property pos end 'face new)
384 (setq pos end
385 old (erc-list (get-text-property pos 'face))
386 end (next-single-property-change pos 'face nil to)))))
387
388;; widget-button-click calls with two args, we ignore the first.
389;; Since Emacs runs this directly, rather than with
390;; widget-button-click, we need to fake an extra arg in the
391;; interactive spec.
392(defun erc-button-click-button (ignore event)
393 "Call `erc-button-press-button'."
394 (interactive "P\ne")
395 (save-excursion
396 (mouse-set-point event)
397 (erc-button-press-button)))
398
399;; XEmacs calls this via widget-button-press with a bunch of arguments
400;; which we don't care about.
401(defun erc-button-press-button (&rest ignore)
402 "Check text at point for a callback function.
403If the text at point has a `erc-callback' property,
404call it with the value of the `erc-data' text property."
405 (interactive)
406 (let* ((data (get-text-property (point) 'erc-data))
407 (fun (get-text-property (point) 'erc-callback)))
408 (unless fun
409 (message "No button at point"))
410 (when (and fun (symbolp fun) (not (fboundp fun)))
411 (error "Function %S is not bound" fun))
412 (apply fun data)))
413
414(defun erc-button-next ()
415 "Go to the next button in this buffer."
416 (interactive)
417 (let ((here (point)))
418 (when (< here (erc-beg-of-input-line))
419 (while (and (get-text-property here 'erc-callback)
420 (not (= here (point-max))))
421 (setq here (1+ here)))
422 (while (and (not (get-text-property here 'erc-callback))
423 (not (= here (point-max))))
424 (setq here (1+ here)))
425 (if (< here (point-max))
426 (goto-char here)
427 (error "No next button"))
428 t)))
429
430(defun erc-browse-emacswiki (thing)
431 "Browse to thing in the emacs-wiki."
432 (browse-url (concat erc-emacswiki-url thing)))
433
434(defun erc-browse-emacswiki-lisp (thing)
435 "Browse to THING in the emacs-wiki elisp area."
436 (browse-url (concat erc-emacswiki-lisp-url thing)))
437
438;;; Nickname buttons:
439
440(defcustom erc-nick-popup-alist
441 '(("DeOp" . (erc-cmd-DEOP nick))
442 ("Kick" . (erc-cmd-KICK (concat nick " "
443 (read-from-minibuffer
444 (concat "Kick " nick ", reason: ")))))
445 ("Msg" . (erc-cmd-MSG (concat nick " "
446 (read-from-minibuffer
447 (concat "Message to " nick ": ")))))
448 ("Op" . (erc-cmd-OP nick))
449 ("Query" . (erc-cmd-QUERY nick))
450 ("Whois" . (erc-cmd-WHOIS nick))
451 ("Lastlog" . (erc-cmd-LASTLOG nick)))
452 "*An alist of possible actions to take on a nickname.
453An entry looks like (\"Action\" . SEXP) where SEXP is evaluated with
454the variable `nick' bound to the nick in question.
455
456Examples:
457 (\"DebianDB\" .
458 (shell-command
459 (format
460 \"ldapsearch -x -P 2 -h db.debian.org -b dc=debian,dc=org ircnick=%s\"
461 nick)))"
462 :group 'erc-button
463 :type '(repeat (cons (string :tag "Op")
464 sexp)))
465
466(defun erc-nick-popup (nick)
467 (let* ((completion-ignore-case t)
468 (action (completing-read (concat "What action to take on '" nick "'? ")
469 erc-nick-popup-alist))
470 (code (cdr (assoc action erc-nick-popup-alist))))
471 (when code
472 (erc-set-active-buffer (current-buffer))
473 (eval code))))
474
475;;; Callback functions
476(defun erc-button-describe-symbol (symbol-name)
477 "Describe SYMBOL-NAME.
478Use `describe-function' for functions, `describe-variable' for variables,
479and `apropos' for other symbols."
480 (let ((symbol (intern-soft symbol-name)))
481 (cond ((and symbol (fboundp symbol))
482 (describe-function symbol))
483 ((and symbol (boundp symbol))
484 (describe-variable symbol))
485 (t (apropos symbol-name)))))
486
487(defun erc-button-beats-to-time (beats)
488 "Display BEATS in a readable time format."
489 (let* ((seconds (- (* (string-to-number beats) 86.4)
490 3600
491 (- (car (current-time-zone)))))
492 (hours (mod (floor seconds 3600) 24))
493 (minutes (mod (round seconds 60) 60)))
494 (message (format "@%s is %d:%02d local time"
495 beats hours minutes))))
496
497(provide 'erc-button)
498
499;;; erc-button.el ends here
500;; Local Variables:
501;; indent-tabs-mode: nil
502;; End:
503
504;; arch-tag: 7d23bed4-2f30-4273-a03f-d7a274c605c4
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
new file mode 100644
index 00000000000..2a06fa96b62
--- /dev/null
+++ b/lisp/erc/erc-compat.el
@@ -0,0 +1,207 @@
1;;; erc-compat.el --- ERC compatibility code for XEmacs
2
3;; Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?EmacsIRCClient
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This mostly defines stuff that cannot be worked around easily.
28
29;;; Code:
30
31(require 'format-spec)
32
33;;;###autoload (autoload 'erc-define-minor-mode "erc-compat")
34(defalias 'erc-define-minor-mode 'define-minor-mode)
35(put 'erc-define-minor-mode 'edebug-form-spec 'define-minor-mode)
36
37(defun erc-decode-coding-string (s coding-system)
38 "Decode S using CODING-SYSTEM."
39 (decode-coding-string s coding-system t))
40
41(defun erc-encode-coding-string (s coding-system)
42 "Encode S using CODING-SYSTEM.
43Return the same string, if the encoding operation is trivial.
44See `erc-encoding-coding-alist'."
45 (encode-coding-string s coding-system t))
46
47(defalias 'erc-propertize 'propertize)
48(defalias 'erc-view-mode-enter 'view-mode-enter)
49(defalias 'erc-function-arglist 'help-function-arglist)
50(defalias 'erc-delete-dups 'delete-dups)
51(defalias 'erc-replace-regexp-in-string 'replace-regexp-in-string)
52
53(defvar erc-emacs-build-time
54 (if (stringp emacs-build-time)
55 emacs-build-time
56 (format-time-string "%Y-%m-%d" emacs-build-time))
57 "Time at which Emacs was dumped out.")
58
59;; XEmacs' `replace-match' does not replace matching subexpressions in strings.
60(defun erc-replace-match-subexpression-in-string
61 (newtext string match subexp start &optional fixedcase literal)
62 "Replace the subexpression SUBEXP of the last match in STRING with NEWTEXT.
63MATCH is the text which matched the subexpression (see `match-string').
64START is the beginning position of the last match (see `match-beginning').
65See `replace-match' for explanations of FIXEDCASE and LITERAL."
66 (cond ((featurep 'xemacs)
67 (string-match match string start)
68 (replace-match newtext fixedcase literal string))
69 (t (replace-match newtext fixedcase literal string subexp))))
70
71(defalias 'erc-cancel-timer 'cancel-timer)
72(defalias 'erc-make-obsolete 'make-obsolete)
73(defalias 'erc-make-obsolete-variable 'make-obsolete-variable)
74
75;; Provde an equivalent of `assert', based on the code from cl-macs.el
76(defun erc-const-expr-p (x)
77 (cond ((consp x)
78 (or (eq (car x) 'quote)
79 (and (memq (car x) '(function function*))
80 (or (symbolp (nth 1 x))
81 (and (eq (and (consp (nth 1 x))
82 (car (nth 1 x))) 'lambda) 'func)))))
83 ((symbolp x) (and (memq x '(nil t)) t))
84 (t t)))
85
86(put 'erc-assertion-failed 'error-conditions '(error))
87(put 'erc-assertion-failed 'error-message "Assertion failed")
88
89(defun erc-list* (arg &rest rest)
90 "Return a new list with specified args as elements, cons'd to last arg.
91Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
92`(cons A (cons B (cons C D)))'."
93 (cond ((not rest) arg)
94 ((not (cdr rest)) (cons arg (car rest)))
95 (t (let* ((n (length rest))
96 (copy (copy-sequence rest))
97 (last (nthcdr (- n 2) copy)))
98 (setcdr last (car (cdr last)))
99 (cons arg copy)))))
100
101(defmacro erc-assert (form &optional show-args string &rest args)
102 "Verify that FORM returns non-nil; signal an error if not.
103Second arg SHOW-ARGS means to include arguments of FORM in message.
104Other args STRING and ARGS... are arguments to be passed to `error'.
105They are not evaluated unless the assertion fails. If STRING is
106omitted, a default message listing FORM itself is used."
107 (let ((sargs
108 (and show-args
109 (delq nil (mapcar
110 (function
111 (lambda (x)
112 (and (not (erc-const-expr-p x)) x)))
113 (cdr form))))))
114 (list 'progn
115 (list 'or form
116 (if string
117 (erc-list* 'error string (append sargs args))
118 (list 'signal '(quote erc-assertion-failed)
119 (erc-list* 'list (list 'quote form) sargs))))
120 nil)))
121
122;; Provide a simpler replacement for `member-if'
123(defun erc-member-if (predicate list)
124 "Find the first item satisfying PREDICATE in LIST.
125Return the sublist of LIST whose car matches."
126 (let ((ptr list))
127 (catch 'found
128 (while ptr
129 (when (funcall predicate (car ptr))
130 (throw 'found ptr))
131 (setq ptr (cdr ptr))))))
132
133;; Provide a simpler replacement for `delete-if'
134(defun erc-delete-if (predicate seq)
135 "Remove all items satisfying PREDICATE in SEQ.
136This is a destructive function: it reuses the storage of SEQ
137whenever possible."
138 ;; remove from car
139 (while (when (funcall predicate (car seq))
140 (setq seq (cdr seq))))
141 ;; remove from cdr
142 (let ((ptr seq)
143 (next (cdr seq)))
144 (while next
145 (when (funcall predicate (car next))
146 (setcdr ptr (if (consp next)
147 (cdr next)
148 nil)))
149 (setq ptr (cdr ptr))
150 (setq next (cdr ptr))))
151 seq)
152
153;; Provide a simpler replacement for `remove-if-not'
154(defun erc-remove-if-not (predicate seq)
155 "Remove all items not satisfying PREDICATE in SEQ.
156This is a non-destructive function; it makes a copy of SEQ to
157avoid corrupting the original SEQ."
158 (let (newseq)
159 (dolist (el seq)
160 (when (funcall predicate el)
161 (setq newseq (cons el newseq))))
162 (nreverse newseq)))
163
164;; Provide a simpler replacement for `gensym'.
165(defvar *erc-sym-counter* 0)
166(defun erc-gensym ()
167 "Generate a new uninterned symbol."
168 (let ((num (prog1 *erc-sym-counter*
169 (setq *erc-sym-counter* (1+ *erc-sym-counter*)))))
170 (make-symbol (format "*erc-sym-%d*" num))))
171
172;; Copied from cl-extra.el
173(defun erc-subseq (seq start &optional end)
174 "Return the subsequence of SEQ from START to END.
175If END is omitted, it defaults to the length of the sequence.
176If START or END is negative, it counts from the end."
177 (if (stringp seq) (substring seq start end)
178 (let (len)
179 (and end (< end 0) (setq end (+ end (setq len (length seq)))))
180 (if (< start 0) (setq start (+ start (or len (setq len (length seq))))))
181 (cond ((listp seq)
182 (if (> start 0) (setq seq (nthcdr start seq)))
183 (if end
184 (let ((res nil))
185 (while (>= (setq end (1- end)) start)
186 (push (pop seq) res))
187 (nreverse res))
188 (copy-sequence seq)))
189 (t
190 (or end (setq end (or len (length seq))))
191 (let ((res (make-vector (max (- end start) 0) nil))
192 (i 0))
193 (while (< start end)
194 (aset res i (aref seq start))
195 (setq i (1+ i) start (1+ start)))
196 res))))))
197
198(provide 'erc-compat)
199
200;;; erc-compat.el ends here
201;;
202;; Local Variables:
203;; indent-tabs-mode: t
204;; tab-width: 8
205;; End:
206
207;; arch-tag: 8948ffe0-aff8-4ad8-a196-368ebbfd58ff
diff --git a/lisp/erc/erc-complete.el b/lisp/erc/erc-complete.el
new file mode 100644
index 00000000000..3b124f597ce
--- /dev/null
+++ b/lisp/erc/erc-complete.el
@@ -0,0 +1,222 @@
1;;; erc-complete.el --- Provides Nick name completion for ERC
2
3;; Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcCompletion
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This file is obsolete. Use completion from erc-pcomplete instead.
28;; This file is based on hippie-expand, while the new file is based on
29;; pcomplete. There is no autoload cookie in this file. If you want
30;; to use the code in this file, add the following to your ~/.emacs:
31
32;; (autoload 'erc-complete "erc-complete" "Complete nick at point." t)
33
34;;; Code:
35
36(require 'erc)
37(require 'erc-match); for erc-pals
38(require 'hippie-exp); for the hippie expand stuff
39
40;;;###autoload
41(defun erc-complete ()
42 "Complete nick at point.
43See `erc-try-complete-nick' for more technical info.
44This function is obsolete, use `erc-pcomplete' instead."
45 (interactive)
46 (let ((hippie-expand-try-functions-list '(erc-try-complete-nick)))
47 (hippie-expand nil)))
48
49(defgroup erc-old-complete nil
50 "Nick completion. Obsolete, use erc-pcomplete instead."
51 :group 'erc)
52
53(defcustom erc-nick-completion 'all
54 "Determine how the list of nicks is determined during nick completion.
55See `erc-complete-nick' for information on how to activate this.
56
57pals: Use `erc-pals'.
58all: All channel members.
59
60You may also provide your own function that returns a list of completions.
61One example is `erc-nick-completion-exclude-myself',
62or you may use an arbitrary lisp expression."
63 :type '(choice (const :tag "List of pals" pals)
64 (const :tag "All channel members" all)
65 (const :tag "All channel members except yourself"
66 erc-nick-completion-exclude-myself)
67 (repeat :tag "List" (string :tag "Nick"))
68 function
69 sexp)
70 :group 'erc-old-complete)
71
72(defcustom erc-nick-completion-ignore-case t
73 "*Non-nil means don't consider case significant in nick completion.
74Case will be automatically corrected when non-nil.
75For instance if you type \"dely TAB\" the word completes and changes to
76\"delYsid\"."
77 :group 'erc-old-complete
78 :type 'boolean)
79
80(defun erc-nick-completion-exclude-myself ()
81 "Get a list of all the channel members except you.
82
83This function returns a list of all the members in the channel, except
84your own nick. This way if you're named foo and someone is called foobar,
85typing \"f o TAB\" will directly give you foobar. Use this with
86`erc-nick-completion'."
87 (delete
88 (erc-current-nick)
89 (mapcar (function car) (erc-get-channel-user-list))))
90
91(defcustom erc-nick-completion-postfix ": "
92 "*When `erc-complete' is used in the first word after the prompt,
93add this string when a unique expansion was found."
94 :group 'erc-old-complete
95 :type 'string)
96
97(defun erc-command-list ()
98 "Returns a list of strings of the defined user commands."
99 (let ((case-fold-search nil))
100 (mapcar (lambda (x)
101 (concat "/" (downcase (substring (symbol-name x) 8))))
102 (apropos-internal "erc-cmd-[A-Z]+"))))
103
104(defun erc-try-complete-nick (old)
105 "Complete nick at point.
106This is a function to put on `hippie-expand-try-functions-list'.
107Then use \\[hippie-expand] to expand nicks.
108The type of completion depends on `erc-nick-completion'."
109 (cond ((eq erc-nick-completion 'pals)
110 (try-complete-erc-nick old erc-pals))
111 ((eq erc-nick-completion 'all)
112 (try-complete-erc-nick old (append
113 (mapcar (function car)
114 (erc-get-channel-user-list))
115 (erc-command-list))))
116 ((functionp erc-nick-completion)
117 (try-complete-erc-nick old (funcall erc-nick-completion)))
118 (t
119 (try-complete-erc-nick old erc-nick-completion))))
120
121(defvar try-complete-erc-nick-window-configuration nil
122 "The window configuration for `try-complete-erc-nick'.
123When called the first time, a window config is stored here,
124and when completion is done, the window config is restored
125from here. See `try-complete-erc-nick-restore' and
126`try-complete-erc-nick'.")
127
128(defun try-complete-erc-nick-restore ()
129 "Restore window configuration."
130 (if (not try-complete-erc-nick-window-configuration)
131 (when (get-buffer "*Completions*")
132 (delete-windows-on "*Completions*"))
133 (set-window-configuration
134 try-complete-erc-nick-window-configuration)
135 (setq try-complete-erc-nick-window-configuration nil)))
136
137(defun try-complete-erc-nick (old completions)
138 "Try to complete current word depending on `erc-try-complete-nick'.
139The argument OLD has to be nil the first call of this function, and t
140for subsequent calls (for further possible completions of the same
141string). It returns t if a new completion is found, nil otherwise. The
142second argument COMPLETIONS is a list of completions to use. Actually,
143it is only used when OLD is nil. It will be copied to `he-expand-list'
144on the first call. After that, it is no longer used.
145Window configurations are stored in
146`try-complete-erc-nick-window-configuration'."
147 (let (expansion
148 final
149 (alist (if (consp (car completions))
150 completions
151 (mapcar (lambda (s)
152 (if (and (erc-complete-at-prompt)
153 (and (not (= (length s) 0))
154 (not (eq (elt s 0) ?/))))
155 (list (concat s erc-nick-completion-postfix))
156 (list (concat s " "))))
157 completions))) ; make alist if required
158 (completion-ignore-case erc-nick-completion-ignore-case))
159 (he-init-string (he-dabbrev-beg) (point))
160 ;; If there is a string to complete, complete it using alist.
161 ;; expansion is the possible expansion, or t. If expansion is t
162 ;; or if expansion is the "real" thing, we are finished (final is
163 ;; t). Take care -- expansion can also be nil!
164 (unless (string= he-search-string "")
165 (setq expansion (try-completion he-search-string alist)
166 final (or (eq t expansion)
167 (and expansion
168 (eq t (try-completion expansion alist))))))
169 (cond ((not expansion)
170 ;; There is no expansion at all.
171 (try-complete-erc-nick-restore)
172 (he-reset-string)
173 nil)
174 ((eq t expansion)
175 ;; The user already has the correct expansion.
176 (try-complete-erc-nick-restore)
177 (he-reset-string)
178 t)
179 ((and old (string= expansion he-search-string))
180 ;; This is the second time around and nothing changed,
181 ;; ie. the user tried to expand something incomplete
182 ;; without making a choice -- hitting TAB twice, for
183 ;; example.
184 (try-complete-erc-nick-restore)
185 (he-reset-string)
186 nil)
187 (final
188 ;; The user has found the correct expansion.
189 (try-complete-erc-nick-restore)
190 (he-substitute-string expansion)
191 t)
192 (t
193 ;; We found something but we are not finished. Show a
194 ;; completions buffer. Substitute what we found and return
195 ;; t.
196 (setq try-complete-erc-nick-window-configuration
197 (current-window-configuration))
198 (with-output-to-temp-buffer "*Completions*"
199 (display-completion-list (all-completions he-search-string alist)))
200 (he-substitute-string expansion)
201 t))))
202
203(defun erc-at-beginning-of-line-p (point &optional bol-func)
204 (save-excursion
205 (funcall (or bol-func
206 'erc-bol))
207 (equal point (point))))
208
209(defun erc-complete-at-prompt ()
210 "Returns t if point is directly after `erc-prompt' when doing completion."
211 (erc-at-beginning-of-line-p (he-dabbrev-beg)))
212
213(provide 'erc-complete)
214
215;;; erc-complete.el ends here
216;;
217;; Local Variables:
218;; indent-tabs-mode: t
219;; tab-width: 8
220;; End:
221
222;; arch-tag: 3be13ee8-8fdb-41ab-83c2-6582c757b91e
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
new file mode 100644
index 00000000000..d5789a51708
--- /dev/null
+++ b/lisp/erc/erc-dcc.el
@@ -0,0 +1,1135 @@
1;;; erc-dcc.el --- CTCP DCC module for ERC
2
3;; Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003, 2004
4;; Free Software Foundation, Inc.
5
6;; Author: Ben A. Mesander <ben@gnu.ai.mit.edu>
7;; Noah Friedman <friedman@prep.ai.mit.edu>
8;; Per Persson <pp@sno.pp.se>
9;; Maintainer: mlang@delysid.org
10;; Keywords: comm, processes
11;; Created: 1994-01-23
12
13;; This file is part of GNU Emacs.
14
15;; GNU Emacs is free software; you can redistribute it and/or modify
16;; it under the terms of the GNU General Public License as published by
17;; the Free Software Foundation; either version 2, or (at your option)
18;; any later version.
19
20;; GNU Emacs is distributed in the hope that it will be useful,
21;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;; GNU General Public License for more details.
24
25;; You should have received a copy of the GNU General Public License
26;; along with GNU Emacs; see the file COPYING. If not, write to the
27;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28;; Boston, MA 02110-1301, USA.
29
30;;; Commentary:
31
32;; This file provides Direct Client-to-Client support for the Emacs IRC Client.
33;;
34;; The original code was taken from zenirc-dcc.el, heavily mangled and
35;; rewritten to support the way how ERC operates. Server socket support
36;; was added for DCC CHAT and SEND afterwards. Thanks
37;; to the original authors for their work.
38;;
39;; To use this file, put
40;; (require 'erc-dcc)
41;; in your .emacs.
42;;
43;; Provided commands
44;; /dcc chat nick - Either accept pending chat offer from nick, or offer
45;; DCC chat to nick
46;; /dcc close type [nick] - Close DCC connection (SEND/GET/CHAT) with nick
47;; /dcc get nick [file] - Accept DCC offer from nick
48;; /dcc list - List all DCC offers/connections
49;; /dcc send nick file - Offer DCC SEND to nick
50;;
51;; Please note that offering DCC connections (offering chats and sending
52;; files) is only supported with Emacs 21.3.50 (CVS).
53
54;;; Code:
55
56(require 'erc)
57(eval-when-compile
58 (require 'pcomplete))
59
60(defgroup erc-dcc nil
61 "DCC stands for Direct Client Communication, where you and your
62friend's client programs connect directly to each other,
63bypassing IRC servers and their occasional \"lag\" or \"split\"
64problems. Like /MSG, the DCC chat is completely private.
65
66Using DCC get and send, you can transfer files directly from and to other
67IRC users."
68 :group 'erc)
69
70(defcustom erc-verbose-dcc t
71 "*If non-nil, be verbose about DCC activity reporting."
72 :group 'erc-dcc
73 :type 'boolean)
74
75(defvar erc-dcc-list nil
76 "List of DCC connections. Looks like:
77 ((:nick \"nick!user@host\" :type GET :peer proc :parent proc :size size :file file)
78 (:nick \"nick!user@host\" :type CHAT :peer proc :parent proc)
79 (:nick \"nick\" :type SEND :peer server-proc :parent parent-proc :file
80 file :sent <marker> :confirmed <marker>))
81
82 :nick - a user or userhost for the peer. combine with :parent to reach them
83
84 :type - the type of DCC connection - SEND for outgoing files, GET for
85 incoming, and CHAT for both directions. To tell which end started
86 the DCC chat, look at :peer
87
88 :peer - the other end of the DCC connection. In the case of outgoing DCCs,
89 this represents a server process until a connection is established
90
91 :parent - the server process where the dcc connection was established.
92 Note that this can be nil or an invalid process since a DCC
93 connection is in general independent from a particular server
94 connection after it was established.
95
96 :file - for outgoing sends, the full path to the file. for incoming sends,
97 the suggested filename or vetted filename
98
99 :size - size of the file, may be nil on incoming DCCs")
100
101(defun erc-dcc-list-add (type nick peer parent &rest args)
102 "Add a new entry of type TYPE to `erc-dcc-list' and return it."
103 (car
104 (setq erc-dcc-list
105 (cons
106 (append (list :nick nick :type type :peer peer :parent parent) args)
107 erc-dcc-list))))
108
109;; This function takes all the usual args as open-network-stream, plus one
110;; more: the entry data from erc-dcc-list for this particular process.
111(defvar erc-dcc-connect-function 'erc-dcc-open-network-stream)
112
113(defun erc-dcc-open-network-stream (procname buffer addr port entry)
114 (if nil; (fboundp 'open-network-stream-nowait) ;; this currently crashes
115 ;; cvs emacs
116 (open-network-stream-nowait procname buffer addr port)
117 (open-network-stream procname buffer addr port)))
118
119(erc-define-catalog
120 'english
121 '((dcc-chat-discarded
122 . "DCC: previous chat request from %n (%u@%h) discarded")
123 (dcc-chat-ended . "DCC: chat with %n ended %t: %e")
124 (dcc-chat-no-request . "DCC: chat request from %n not found")
125 (dcc-chat-offered . "DCC: chat offered by %n (%u@%h:%p)")
126 (dcc-chat-offer . "DCC: offering chat to %n")
127 (dcc-chat-accept . "DCC: accepting chat from %n")
128 (dcc-chat-privmsg . "=%n= %m")
129 (dcc-closed . "DCC: Closed %T from %n")
130 (dcc-command-undefined
131 . "DCC: %c undefined subcommand. GET, CHAT and LIST are defined.")
132 (dcc-ctcp-errmsg . "DCC: `%s' is not a DCC subcommand known to this client")
133 (dcc-ctcp-unknown . "DCC: unknown dcc command `%q' from %n (%u@%h)")
134 (dcc-get-bytes-received . "DCC: %f: %b bytes received")
135 (dcc-get-complete
136 . "DCC: file %f transfer complete (%s bytes in %t seconds)")
137 (dcc-get-cmd-aborted . "DCC: Aborted getting %f from %n")
138 (dcc-get-file-too-long
139 . "DCC: %f: File longer than sender claimed; aborting transfer")
140 (dcc-get-notfound . "DCC: %n hasn't offered %f for DCC transfer")
141 (dcc-list-head . "DCC: From Type Active Size Filename")
142 (dcc-list-line . "DCC: -------- ---- ------ ------------ --------")
143 (dcc-list-item . "DCC: %-8n %-4t %-6a %-12s %f")
144 (dcc-list-end . "DCC: End of list.")
145 (dcc-malformed . "DCC: error: %n (%u@%h) sent malformed request: %q")
146 (dcc-privileged-port
147 . "DCC: possibly bogus request: %p is a privileged port.")
148 (dcc-request-bogus . "DCC: bogus dcc `%r' from %n (%u@%h)")
149 (dcc-send-finished . "DCC: SEND of %f to %n finished (size %s)")
150 (dcc-send-offered . "DCC: file %f offered by %n (%u@%h) (size %s)")
151 (dcc-send-offer . "DCC: offering %f to %n")))
152
153;;; Misc macros and utility functions
154
155(defun erc-dcc-member (&rest args)
156 "Return the first matching entry in `erc-dcc-list' which satisfies the
157constraints given as a plist in ARGS. Returns nil on no match.
158
159The property :nick is treated specially, if it contains a '!' character,
160it is treated as a nick!user@host string, and compared with the :nick property
161value of the individual elements using string-equal. Otherwise it is
162compared with `erc-nick-equal-p' which is IRC case-insensitive."
163 (let ((list erc-dcc-list)
164 result test)
165 ;; for each element in erc-dcc-list
166 (while (and list (not result))
167 (let ((elt (car list))
168 (prem args)
169 (cont t))
170 ;; loop through the constraints
171 (while (and prem cont)
172 (let ((prop (car prem))
173 (val (cadr prem)))
174 (setq prem (cddr prem)
175 ;; plist-member is a predicate in xemacs
176 test (and (plist-member elt prop)
177 (plist-get elt prop)))
178 ;; if the property exists and is equal, we continue, else, try the
179 ;; next element of the list
180 (or (and (eq prop :nick) (string-match "!" val)
181 test (string-equal test val))
182 (and (eq prop :nick)
183 test val
184 (erc-nick-equal-p
185 (erc-extract-nick test)
186 (erc-extract-nick val)))
187 ;; not a nick
188 (eq test val)
189 (setq cont nil))))
190 (if cont
191 (setq result elt)
192 (setq list (cdr list)))))
193 result))
194
195;; msa wrote this nifty little frob to convert an n-byte integer to a packed
196;; string.
197(defun erc-pack-int (value count)
198 (if (> count 0)
199 (concat (erc-pack-int (/ value 256) (1- count))
200 (char-to-string (% value 256)))
201 ""))
202
203(defun erc-unpack-int (str)
204 "Unpack a 1-4 character packed string into an integer."
205 (let ((len (length str))
206 (num 0)
207 (count 0))
208 (erc-assert (<= len 4)) ;; this isn't going to fit in elisp bounds
209 (while (< count len)
210 (setq num (+ num (lsh (aref str (- len count 1)) (* 8 count))))
211 (setq count (1+ count)))
212 num))
213
214(defconst erc-dcc-ipv4-regexp
215 (concat "^"
216 (mapconcat #'identity (make-list 4 "\\([0-9]\\{1,3\\}\\)") "\\.")
217 "$"))
218
219(defun erc-ip-to-decimal (ip)
220 "Convert IP address to its decimal representation.
221Argument IP is the address as a string. The result is also a string."
222 (interactive "sIP Address: ")
223 (if (not (string-match erc-dcc-ipv4-regexp ip))
224 (error "Not an IP address")
225 (let* ((ips (mapcar
226 (lambda (str)
227 (let ((n (string-to-number str)))
228 (if (and (>= n 0) (< n 256))
229 n
230 (error "%d out of range" n))))
231 (split-string ip "\\.")))
232 (res (+ (* (car ips) 16777216.0)
233 (* (nth 1 ips) 65536.0)
234 (* (nth 2 ips) 256.0)
235 (nth 3 ips))))
236 (if (interactive-p)
237 (message "%s is %.0f" ip res)
238 (format "%.0f" res)))))
239
240(defun erc-decimal-to-ip (dec)
241 "Convert a decimal representation DEC to an IP address.
242The result is also a string."
243 (when (stringp dec)
244 (setq dec (string-to-number (concat dec ".0"))))
245 (let* ((first (floor (/ dec 16777216.0)))
246 (first-rest (- dec (* first 16777216.0)))
247 (second (floor (/ first-rest 65536.0)))
248 (second-rest (- first-rest (* second 65536.0)))
249 (third (floor (/ second-rest 256.0)))
250 (third-rest (- second-rest (* third 256.0)))
251 (fourth (floor third-rest)))
252 (format "%s.%s.%s.%s" first second third fourth)))
253
254;;; Server code
255
256(defcustom erc-dcc-host nil
257 "*IP address to use for outgoing DCC offers.
258Should be set to a string or nil, if nil, automatic detection of the
259host interface to use will be attempted."
260 :group 'erc-dcc
261 :type (list 'choice (list 'const :tag "Auto-detect" nil)
262 (list 'string :tag "IP-address"
263 :valid-regexp erc-dcc-ipv4-regexp)))
264
265(defcustom erc-dcc-send-request 'ask
266 "*How to treat incoming DCC Send requests.
267'ask - Report the Send request, and wait for the user to manually accept it
268 You might want to set `erc-dcc-auto-masks' for this.
269'auto - Automatically accept the request and begin downloading the file
270'ignore - Ignore incoming DCC Send requests completely."
271 :group 'erc-dcc
272 :type '(choice (const ask) (const auto) (const ignore)))
273
274(defun erc-dcc-get-host (proc)
275 "Returns the local IP address used for an open PROCess."
276 (format-network-address (process-contact proc :local) t))
277
278(defun erc-dcc-host ()
279 "Determine the IP address we are using.
280If variable `erc-dcc-host' is non-nil, use it. Otherwise call
281`erc-dcc-get-host' on the erc-server-process."
282 (or erc-dcc-host (erc-dcc-get-host erc-server-process)
283 (error "Unable to determine local address")))
284
285(defcustom erc-dcc-port-range nil
286 "If nil, any available user port is used for outgoing DCC connections.
287If set to a cons, it specifies a range of ports to use in the form (min . max)"
288 :group 'erc-dcc
289 :type '(choice
290 (const :tag "Any port" nil)
291 (cons :tag "Port range"
292 (integer :tag "Lower port")
293 (integer :tag "Upper port"))))
294
295(defcustom erc-dcc-auto-masks nil
296 "List of regexps matching user identifiers whose DCC send offers should be
297accepted automatically. A user identifier has the form \"nick!login@host\".
298For instance, to accept all incoming DCC send offers automatically, add the
299string \".*!.*@.*\" to this list."
300 :group 'erc-dcc
301 :type '(repeat regexp))
302
303(defun erc-dcc-server (name filter sentinel)
304 "Start listening on a port for an incoming DCC connection. Returns the newly
305created subprocess, or nil."
306 (let ((port (or (and erc-dcc-port-range (car erc-dcc-port-range)) t))
307 (upper (and erc-dcc-port-range (cdr erc-dcc-port-range)))
308 process)
309 (while (not process)
310 (condition-case err
311 (setq process
312 (make-network-process :name name
313 :buffer nil
314 :host (erc-dcc-host)
315 :service port
316 :nowait t
317 :noquery nil
318 :filter filter
319 :sentinel sentinel
320 :log #'erc-dcc-server-accept
321 :server t))
322 (file-error
323 (unless (and (string= "Cannot bind server socket" (cadr err))
324 (string= "address already in use" (caddr err)))
325 (signal (car err) (cdr err)))
326 (setq port (1+ port))
327 (unless (< port upper)
328 (error "No available ports in erc-dcc-port-range")))))
329 process))
330
331(defun erc-dcc-server-accept (server client message)
332 "Log an accepted DCC offer, then terminate the listening process and set up
333the accepted connection."
334 (erc-log (format "(erc-dcc-server-accept): server %s client %s message %s"
335 server client message))
336 (when (and (string-match "^accept from " message)
337 (processp server) (processp client))
338 (let ((elt (erc-dcc-member :peer server)))
339 ;; change the entry in erc-dcc-list from the listening process to the
340 ;; accepted process
341 (setq elt (plist-put elt :peer client))
342 ;; delete the listening process, as we've accepted the connection
343 (delete-process server))))
344
345;;; Interactive command handling
346
347(defcustom erc-dcc-get-default-directory nil
348 "*Default directory for incoming DCC file transfers.
349If this is nil, then the current value of `default-directory' is used."
350 :group 'erc-dcc
351 :type '(choice (const nil :tag "Default directory") directory))
352
353;;;###autoload
354(defun erc-cmd-DCC (cmd &rest args)
355 "Parser for /dcc command.
356This figures out the dcc subcommand and calls the appropriate routine to
357handle it. The function dispatched should be named \"erc-dcc-do-FOO-command\",
358where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
359 (when cmd
360 (let ((fn (intern-soft (concat "erc-dcc-do-" (upcase cmd) "-command"))))
361 (if fn
362 (apply fn erc-server-process args)
363 (erc-display-message
364 nil 'notice 'active
365 'dcc-command-undefined ?c cmd)
366 (apropos "erc-dcc-do-.*-command")
367 t))))
368
369;;;###autoload
370(defun pcomplete/erc-mode/DCC ()
371 "Provides completion for the /DCC command."
372 (pcomplete-here (append '("chat" "close" "get" "list")
373 (when (fboundp 'make-network-process) '("send"))))
374 (pcomplete-here
375 (case (intern (downcase (pcomplete-arg 1)))
376 (chat (mapcar (lambda (elt) (plist-get elt :nick))
377 (erc-remove-if-not
378 #'(lambda (elt)
379 (eq (plist-get elt :type) 'CHAT))
380 erc-dcc-list)))
381 (close (remove-duplicates
382 (mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
383 erc-dcc-list) :test 'string=))
384 (get (mapcar #'erc-dcc-nick
385 (erc-remove-if-not
386 #'(lambda (elt)
387 (eq (plist-get elt :type) 'GET))
388 erc-dcc-list)))
389 (send (pcomplete-erc-all-nicks))))
390 (pcomplete-here
391 (case (intern (downcase (pcomplete-arg 2)))
392 (get (mapcar (lambda (elt) (plist-get elt :file))
393 (erc-remove-if-not
394 #'(lambda (elt)
395 (and (eq (plist-get elt :type) 'GET)
396 (erc-nick-equal-p (erc-extract-nick
397 (plist-get elt :nick))
398 (pcomplete-arg 1))))
399 erc-dcc-list)))
400 (close (mapcar #'erc-dcc-nick
401 (erc-remove-if-not
402 #'(lambda (elt)
403 (eq (plist-get elt :type)
404 (intern (upcase (pcomplete-arg 1)))))
405 erc-dcc-list)))
406 (send (pcomplete-entries)))))
407
408(defun erc-dcc-do-CHAT-command (proc &optional nick)
409 (when nick
410 (let ((elt (erc-dcc-member :nick nick :type 'CHAT :parent proc)))
411 (if (and elt (not (processp (plist-get elt :peer))))
412 ;; accept an existing chat offer
413 ;; FIXME: perhaps /dcc accept like other clients?
414 (progn (erc-dcc-chat-accept elt erc-server-process)
415 (erc-display-message
416 nil 'notice 'active
417 'dcc-chat-accept ?n nick)
418 t)
419 (erc-dcc-chat nick erc-server-process)
420 (erc-display-message
421 nil 'notice 'active
422 'dcc-chat-offer ?n nick)
423 t))))
424
425(defun erc-dcc-do-CLOSE-command (proc &optional type nick)
426 "/dcc close type nick
427type and nick are optional."
428 ;; FIXME, should also work if only nick is specified
429 (when (string-match (concat "^\\s-*\\(\\S-+\\)? *\\("
430 erc-valid-nick-regexp "\\)?\\s-*$") line)
431 (let ((type (when (match-string 1 line)
432 (intern (upcase (match-string 1 line)))))
433 (nick (match-string 2 line))
434 (ret t))
435 (while ret
436 (if nick
437 (setq ret (erc-dcc-member :type type :nick nick))
438 (setq ret (erc-dcc-member :type type)))
439 (when ret
440 ;; found a match - delete process if it exists.
441 (and (processp (plist-get ret :peer))
442 (delete-process (plist-get ret :peer)))
443 (setq erc-dcc-list (delq ret erc-dcc-list))
444 (erc-display-message
445 nil 'notice 'active
446 'dcc-closed
447 ?T (plist-get ret :type)
448 ?n (erc-extract-nick (plist-get ret :nick))))))
449 t))
450
451(defun erc-dcc-do-GET-command (proc nick &optional file)
452 (let* ((elt (erc-dcc-member :nick nick :type 'GET))
453 (filename (or file (plist-get elt :file) "unknown")))
454 (if elt
455 (let* ((file (read-file-name
456 (format "Local filename (default %s): "
457 (file-name-nondirectory filename))
458 (or erc-dcc-get-default-directory
459 default-directory)
460 (expand-file-name (file-name-nondirectory filename)
461 (or erc-dcc-get-default-directory
462 default-directory)))))
463 (cond ((file-exists-p file)
464 (if (yes-or-no-p (format "File %s exists. Overwrite? "
465 file))
466 (erc-dcc-get-file elt file proc)
467 (erc-display-message
468 nil '(notice error) proc
469 'dcc-get-cmd-aborted
470 ?n nick ?f filename)))
471 (t
472 (erc-dcc-get-file elt file proc))))
473 (erc-display-message
474 nil '(notice error) 'active
475 'dcc-get-notfound ?n nick ?f filename))))
476
477(defun erc-dcc-do-LIST-command (proc)
478 "This is the handler for the /dcc list command.
479It lists the current state of `erc-dcc-list' in an easy to read manner."
480 (let ((alist erc-dcc-list)
481 size elt)
482 (erc-display-message
483 nil 'notice 'active
484 'dcc-list-head)
485 (erc-display-message
486 nil 'notice 'active
487 'dcc-list-line)
488 (while alist
489 (setq elt (car alist)
490 alist (cdr alist))
491
492 (setq size (or (and (plist-member elt :size)
493 (plist-get elt :size))
494 ""))
495 (setq size
496 (cond ((null size) "")
497 ((numberp size) (number-to-string size))
498 ((string= size "") "unknown")))
499 (erc-display-message
500 nil 'notice 'active
501 'dcc-list-item
502 ?n (erc-dcc-nick elt)
503 ?t (plist-get elt :type)
504 ?a (if (processp (plist-get elt :peer))
505 (process-status (plist-get elt :peer))
506 "no")
507 ?s (concat size
508 (if (and (eq 'GET (plist-get elt :type))
509 (plist-member elt :file)
510 (buffer-live-p (get-buffer (plist-get elt :file)))
511 (plist-member elt :size))
512 (concat " (" (number-to-string
513 (* 100
514 (/ (buffer-size
515 (get-buffer (plist-get elt :file)))
516 (plist-get elt :size))))
517 "%)")))
518 ?f (or (and (plist-member elt :file) (plist-get elt :file)) "")))
519 (erc-display-message
520 nil 'notice 'active
521 'dcc-list-end)
522 t))
523
524(defun erc-dcc-do-SEND-command (proc nick file)
525 "Offer FILE to NICK by sending a ctcp dcc send message."
526 (if (file-exists-p file)
527 (progn
528 (erc-display-message
529 nil 'notice 'active
530 'dcc-send-offer ?n nick ?f file)
531 (erc-dcc-send-file nick file) t)
532 (erc-display-message nil '(notice error) proc "File not found") t))
533
534;;; Server message handling (i.e. messages from remote users)
535
536;;;###autoload
537(defvar erc-ctcp-query-DCC-hook '(erc-ctcp-query-DCC)
538 "Hook variable for CTCP DCC queries")
539
540(defvar erc-dcc-query-handler-alist
541 '(("SEND" . erc-dcc-handle-ctcp-send)
542 ("CHAT" . erc-dcc-handle-ctcp-chat)))
543
544;;;###autoload
545(defun erc-ctcp-query-DCC (proc nick login host to query)
546 "The function called when a CTCP DCC request is detected by the client.
547It examines the DCC subcommand, and calls the appropriate routine for
548that subcommand."
549 (let* ((cmd (cadr (split-string query " ")))
550 (handler (cdr (assoc cmd erc-dcc-query-handler-alist))))
551 (if handler
552 (funcall handler proc query nick login host to)
553 ;; FIXME: Send a ctcp error notice to the remote end?
554 (erc-display-message
555 nil '(notice error) proc
556 'dcc-ctcp-unknown
557 ?q query ?n nick ?u login ?h host))))
558
559(defconst erc-dcc-ctcp-query-send-regexp
560 "^DCC SEND \\([^ ]+\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")
561
562(defun erc-dcc-handle-ctcp-send (proc query nick login host to)
563 "This is called if a CTCP DCC SEND subcommand is sent to the client.
564It extracts the information about the dcc request and adds it to
565`erc-dcc-list'."
566 (unless (eq erc-dcc-send-request 'ignore)
567 (cond
568 ((not (erc-current-nick-p to))
569 ;; DCC SEND requests must be sent to you, and you alone.
570 (erc-display-message
571 nil 'notice proc
572 'dcc-request-bogus
573 ?r "SEND" ?n nick ?u login ?h host))
574 ((string-match erc-dcc-ctcp-query-send-regexp query)
575 (let ((filename (match-string 1 query))
576 (ip (erc-decimal-to-ip (match-string 2 query)))
577 (port (match-string 3 query))
578 (size (match-string 4 query)))
579 ;; FIXME: a warning really should also be sent
580 ;; if the ip address != the host the dcc sender is on.
581 (erc-display-message
582 nil 'notice proc
583 'dcc-send-offered
584 ?f filename ?n nick ?u login ?h host
585 ?s (if (string= size "") "unknown" size))
586 (and (< (string-to-number port) 1025)
587 (erc-display-message
588 nil 'notice proc
589 'dcc-privileged-port
590 ?p port))
591 (erc-dcc-list-add
592 'GET (format "%s!%s@%s" nick login host)
593 nil proc
594 :ip ip :port port :file filename
595 :size (string-to-number size))
596 (if (and (eq erc-dcc-send-request 'auto)
597 (erc-dcc-auto-mask-p (format "\"%s!%s@%s\"" nick login host)))
598 (erc-dcc-get-file (car erc-dcc-list) filename proc))))
599 (t
600 (erc-display-message
601 nil 'notice proc
602 'dcc-malformed
603 ?n nick ?u login ?h host ?q query)))))
604
605(defun erc-dcc-auto-mask-p (spec)
606 "Takes a full SPEC of a user in the form \"nick!login@host\" and
607matches against all the regexp's in `erc-dcc-auto-masks'. If any
608match, returns that regexp and nil otherwise."
609 (let ((lst erc-dcc-auto-masks))
610 (while (and lst
611 (not (string-match (car lst) spec)))
612 (setq lst (cdr lst)))
613 (and lst (car lst))))
614
615(defconst erc-dcc-ctcp-query-chat-regexp
616 "^DCC CHAT +chat +\\([0-9]+\\) +\\([0-9]+\\)")
617
618(defcustom erc-dcc-chat-request 'ask
619 "*How to treat incoming DCC Chat requests.
620'ask - Report the Chat request, and wait for the user to manually accept it
621'auto - Automatically accept the request and open a new chat window
622'ignore - Ignore incoming DCC chat requests completely."
623 :group 'erc-dcc
624 :type '(choice (const ask) (const auto) (const ignore)))
625
626(defun erc-dcc-handle-ctcp-chat (proc query nick login host to)
627 (unless (eq erc-dcc-chat-request 'ignore)
628 (cond
629 (;; DCC CHAT requests must be sent to you, and you alone.
630 (not (erc-current-nick-p to))
631 (erc-display-message
632 nil '(notice error) proc
633 'dcc-request-bogus ?r "CHAT" ?n nick ?u login ?h host))
634 ((string-match erc-dcc-ctcp-query-chat-regexp query)
635 ;; We need to use let* here, since erc-dcc-member might clutter
636 ;; the match value.
637 (let* ((ip (erc-decimal-to-ip (match-string 1 query)))
638 (port (match-string 2 query))
639 (elt (erc-dcc-member :nick nick :type 'CHAT)))
640 ;; FIXME: A warning really should also be sent if the ip
641 ;; address != the host the dcc sender is on.
642 (erc-display-message
643 nil 'notice proc
644 'dcc-chat-offered
645 ?n nick ?u login ?h host ?p port)
646 (and (< (string-to-number port) 1025)
647 (erc-display-message
648 nil 'notice proc
649 'dcc-privileged-port ?p port))
650 (cond (elt
651 ;; XXX: why are we updating ip/port on the existing connection?
652 (setq elt (plist-put (plist-put elt :port port) :ip ip))
653 (erc-display-message
654 nil 'notice proc
655 'dcc-chat-discarded ?n nick ?u login ?h host))
656 (t
657 (erc-dcc-list-add
658 'CHAT (format "%s!%s@%s" nick login host)
659 nil proc
660 :ip ip :port port)))
661 (if (eq erc-dcc-chat-request 'auto)
662 (erc-dcc-chat-accept (erc-dcc-member :nick nick :type 'CHAT)
663 proc))))
664 (t
665 (erc-display-message
666 nil '(notice error) proc
667 'dcc-malformed ?n nick ?u login ?h host ?q query)))))
668
669
670(defvar erc-dcc-entry-data nil
671 "Holds the `erc-dcc-list' entry for this DCC connection.")
672(make-variable-buffer-local 'erc-dcc-entry-data)
673
674;;; SEND handling
675
676(defcustom erc-dcc-block-size 1024
677 "*Block size to use for DCC SEND sessions."
678 :group 'erc-dcc
679 :type 'integer)
680
681(defcustom erc-dcc-pump-bytes nil
682 "*If set to an integer, keep sending until that number of bytes are
683unconfirmed."
684 :group 'erc-dcc
685 :type '(choice (const nil) integer))
686
687(defsubst erc-dcc-get-parent (proc)
688 (plist-get (erc-dcc-member :peer proc) :parent))
689
690(defun erc-dcc-send-block (proc)
691 "Send one block of data.
692PROC is the process-object of the DCC connection. Returns the number of
693bytes sent."
694 (let* ((elt (erc-dcc-member :peer proc))
695 (confirmed-marker (plist-get elt :sent))
696 (sent-marker (plist-get elt :sent)))
697 (with-current-buffer (process-buffer proc)
698 (when erc-verbose-dcc
699 (erc-display-message
700 nil 'notice (erc-dcc-get-parent proc)
701 (format "DCC: Confirmed %d, sent %d, sending block now"
702 (- confirmed-marker (point-min))
703 (- sent-marker (point-min)))))
704 (let* ((end (min (+ sent-marker erc-dcc-block-size)
705 (point-max)))
706 (string (buffer-substring-no-properties sent-marker end)))
707 (when (< sent-marker end)
708 (set-marker sent-marker end)
709 (process-send-string proc string))
710 (length string)))))
711
712(defun erc-dcc-send-filter (proc string)
713 (erc-assert (= (% (length string) 4) 0))
714 (let* ((size (erc-unpack-int (substring string (- (length string) 4))))
715 (elt (erc-dcc-member :peer proc))
716 (parent (plist-get elt :parent))
717 (sent-marker (plist-get elt :sent))
718 (confirmed-marker (plist-get elt :confirmed)))
719 (with-current-buffer (process-buffer proc)
720 (set-marker confirmed-marker (+ (point-min) size))
721 (cond
722 ((and (= confirmed-marker sent-marker)
723 (= confirmed-marker (point-max)))
724 (erc-display-message
725 nil 'notice parent
726 'dcc-send-finished
727 ?n (plist-get elt :nick)
728 ?f buffer-file-name
729 ?s (number-to-string (- sent-marker (point-min))))
730 (setq erc-dcc-list (delete elt erc-dcc-list))
731 (set-buffer-modified-p nil)
732 (kill-buffer (current-buffer))
733 (delete-process proc))
734 ((<= confirmed-marker sent-marker)
735 (while (and (< (- sent-marker confirmed-marker)
736 (or erc-dcc-pump-bytes
737 erc-dcc-block-size))
738 (> (erc-dcc-send-block proc) 0))))
739 ((> confirmed-marker sent-marker)
740 (erc-display-message
741 nil 'notice parent
742 (format "DCC: Client confirmed too much!"))
743 (delete-process proc))))))
744
745(defcustom erc-dcc-send-connect-hook
746 '((lambda (proc)
747 (erc-display-message
748 nil 'notice (erc-dcc-get-parent proc)
749 (format "DCC: SEND connect from %s"
750 (format-network-address (process-contact proc :remote)))))
751 erc-dcc-send-block)
752 "*Hook run whenever the remote end of a DCC SEND offer connected to your
753listening port."
754 :group 'erc-dcc
755 :type 'hook)
756
757(defun erc-dcc-nick (plist)
758 "Extract the nickname portion of the :nick property value in PLIST."
759 (erc-extract-nick (plist-get plist :nick)))
760
761(defun erc-dcc-send-sentinel (proc event)
762 (let* ((elt (erc-dcc-member :peer proc))
763 (buf (marker-buffer (plist-get elt :sent))))
764 (cond
765 ((string-match "^open from " event)
766 (when elt
767 (with-current-buffer buf
768 (set-process-buffer proc buf)
769 (setq erc-dcc-entry-data elt))
770 (run-hook-with-args 'erc-dcc-send-connect-hook proc))))))
771
772(defun erc-dcc-find-file (file)
773 (with-current-buffer (generate-new-buffer (file-name-nondirectory file))
774 (insert-file-contents-literally file)
775 (setq buffer-file-name file)
776 (current-buffer)))
777
778(defun erc-dcc-file-to-name (file)
779 (with-temp-buffer
780 (insert (file-name-nondirectory file))
781 (subst-char-in-region (point-min) (point-max) ? ?_ t)
782 (buffer-string)))
783
784(defun erc-dcc-send-file (nick file &optional pproc)
785 "Open a socket for incoming connections, and send a CTCP send request to the
786other client."
787 (interactive "sNick: \nfFile: ")
788 (when (null pproc) (if (processp erc-server-process)
789 (setq pproc erc-server-process)
790 (error "Can not find parent process")))
791 (if (featurep 'make-network-process)
792 (let* ((buffer (erc-dcc-find-file file))
793 (size (buffer-size buffer))
794 (start (with-current-buffer buffer
795 (set-marker (make-marker) (point-min))))
796 (sproc (erc-dcc-server "dcc-send"
797 'erc-dcc-send-filter
798 'erc-dcc-send-sentinel))
799 (contact (process-contact sproc)))
800 (erc-dcc-list-add
801 'SEND nick sproc pproc
802 :file file :size size
803 :sent start :confirmed (copy-marker start))
804 (process-send-string
805 pproc (format "PRIVMSG %s :\C-aDCC SEND %s %s %d %d\C-a\n"
806 nick (erc-dcc-file-to-name file)
807 (erc-ip-to-decimal (nth 0 contact))
808 (nth 1 contact)
809 size)))
810 (error "`make-network-process' not supported by your emacs.")))
811
812;;; GET handling
813
814(defvar erc-dcc-byte-count nil)
815(make-variable-buffer-local 'erc-dcc-byte-count)
816
817(defun erc-dcc-get-file (entry file parent-proc)
818 "This function does the work of setting up a transfer from the remote client
819to the local one over a tcp connection. This involves setting up a process
820filter and a process sentinel, and making the connection."
821 (let* ((buffer (generate-new-buffer (file-name-nondirectory file)))
822 proc)
823 (with-current-buffer buffer
824 (fundamental-mode)
825 ;; This is necessary to have the buffer saved as-is in GNU
826 ;; Emacs.
827 ;; XEmacs change: We don't have `set-buffer-multibyte', setting
828 ;; coding system to 'binary below takes care of us.
829 (when (fboundp 'set-buffer-multibyte)
830 (set-buffer-multibyte nil))
831
832 (setq mode-line-process '(":%s")
833 buffer-file-type t
834 buffer-read-only t)
835 (set-visited-file-name file)
836
837 (setq erc-server-process parent-proc
838 erc-dcc-entry-data entry)
839 (setq erc-dcc-byte-count 0)
840 (setq proc
841 (funcall erc-dcc-connect-function
842 "dcc-get" buffer
843 (plist-get entry :ip)
844 (string-to-number (plist-get entry :port))
845 entry))
846 (set-process-buffer proc buffer)
847 ;; The following two lines make saving as-is work under Windows
848 (set-process-coding-system proc 'binary 'binary)
849 (set-buffer-file-coding-system 'binary t)
850
851 (set-process-filter proc 'erc-dcc-get-filter)
852 (set-process-sentinel proc 'erc-dcc-get-sentinel)
853 (setq entry (plist-put entry :start-time (erc-current-time)))
854 (setq entry (plist-put entry :peer proc)))))
855
856(defun erc-dcc-get-filter (proc str)
857 "This is the process filter for transfers from other clients to this one.
858It reads incoming bytes from the network and stores them in the DCC
859buffer, and sends back the replies after each block of data per the DCC
860protocol spec. Well not really. We write back a reply after each read,
861rather than every 1024 byte block, but nobody seems to care."
862 (with-current-buffer (process-buffer proc)
863 (setq buffer-read-only nil) ;; FIXME
864 (goto-char (point-max))
865 (insert (string-make-unibyte str))
866
867 (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count))
868 (erc-assert (= erc-dcc-byte-count (1- (point-max))))
869 (and erc-verbose-dcc
870 (erc-display-message
871 nil 'notice erc-server-process
872 'dcc-get-bytes-received
873 ?f (file-name-nondirectory buffer-file-name)
874 ?b (number-to-string erc-dcc-byte-count)))
875 (cond
876 ((and (> (plist-get erc-dcc-entry-data :size) 0)
877 (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size)))
878 (erc-display-message
879 nil '(error notice) 'active
880 'dcc-get-file-too-long
881 ?f (file-name-nondirectory buffer-file-name))
882 (delete-process proc))
883 (t
884 (process-send-string
885 proc (erc-pack-int erc-dcc-byte-count 4))))))
886
887
888(defun erc-dcc-get-sentinel (proc event)
889 "This is the process sentinel for CTCP DCC SEND connections.
890It shuts down the connection and notifies the user that the
891transfer is complete."
892 ;; FIXME, we should look at EVENT, and also check size.
893 (with-current-buffer (process-buffer proc)
894 (delete-process proc)
895 (setq buffer-read-only nil)
896 (setq erc-dcc-list (delete erc-dcc-entry-data erc-dcc-list))
897 (erc-display-message
898 nil 'notice erc-server-process
899 'dcc-get-complete
900 ?f (file-name-nondirectory buffer-file-name)
901 ?s (number-to-string (buffer-size))
902 ?t (format "%.0f"
903 (erc-time-diff (plist-get erc-dcc-entry-data :start-time)
904 (erc-current-time))))
905 (save-buffer))
906 (kill-buffer (process-buffer proc))
907 (delete-process proc))
908
909;;; CHAT handling
910
911(defcustom erc-dcc-chat-buffer-name-format "DCC-CHAT-%s"
912 "*Format to use for DCC Chat buffer names."
913 :group 'erc-dcc
914 :type 'string)
915
916(defcustom erc-dcc-chat-mode-hook nil
917 "*Hook calls when `erc-dcc-chat-mode' finished setting up the buffer."
918 :group 'erc-dcc
919 :type 'hook)
920
921(defcustom erc-dcc-chat-connect-hook nil
922 ""
923 :group 'erc-dcc
924 :type 'hook)
925
926(defcustom erc-dcc-chat-exit-hook nil
927 ""
928 :group 'erc-dcc
929 :type 'hook)
930
931(defun erc-cmd-CREQ (line &optional force)
932 "Set or get the DCC chat request flag.
933Possible values are: ask, auto, ignore."
934 (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line)
935 (let ((cmd (match-string 1 line)))
936 (if (stringp cmd)
937 (erc-display-message
938 nil 'notice 'active
939 (format "Set DCC Chat requests to %S"
940 (setq erc-dcc-chat-request (intern cmd))))
941 (erc-display-message nil 'notice 'active
942 (format "DCC Chat requests are set to %S"
943 erc-dcc-chat-request)))
944 t)))
945
946(defun erc-cmd-SREQ (line &optional force)
947 "Set or get the DCC send request flag.
948Possible values are: ask, auto, ignore."
949 (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line)
950 (let ((cmd (match-string 1 line)))
951 (if (stringp cmd)
952 (erc-display-message
953 nil 'notice 'active
954 (format "Set DCC Send requests to %S"
955 (setq erc-dcc-send-request (intern cmd))))
956 (erc-display-message nil 'notice 'active
957 (format "DCC Send requests are set to %S"
958 erc-dcc-send-request)))
959 t)))
960
961(defun pcomplete/erc-mode/CREQ ()
962 (pcomplete-here '("auto" "ask" "ignore")))
963(defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ)
964
965(defvar erc-dcc-chat-filter-hook '(erc-dcc-chat-parse-output)
966 "*Hook to run after doing parsing (and possible insertion) of DCC messages.")
967
968(defvar erc-dcc-chat-mode-map
969 (let ((map (make-sparse-keymap)))
970 (define-key map (kbd "RET") 'erc-send-current-line)
971 (define-key map "\t" 'erc-complete-word)
972 map)
973 "Keymap for `erc-dcc-mode'.")
974
975(defun erc-dcc-chat-mode ()
976 "Major mode for wasting time via DCC chat."
977 (interactive)
978 (kill-all-local-variables)
979 (setq mode-line-process '(":%s")
980 mode-name "DCC-Chat"
981 major-mode 'erc-dcc-chat-mode
982 erc-send-input-line-function 'erc-dcc-chat-send-input-line
983 erc-default-recipients '(dcc))
984 (use-local-map erc-dcc-chat-mode-map)
985 (run-hooks 'erc-dcc-chat-mode-hook))
986
987(defun erc-dcc-chat-send-input-line (recipient line &optional force)
988 "Send LINE to the remote end.
989Argument RECIPIENT should always be the symbol dcc, and force
990is ignored."
991 ;; FIXME: We need to get rid of all force arguments one day!
992 (if (eq recipient 'dcc)
993 (process-send-string
994 (get-buffer-process (current-buffer)) line)
995 (error "erc-dcc-chat-send-input-line in %s" (current-buffer))))
996
997(defun erc-dcc-chat (nick &optional pproc)
998 "Open a socket for incoming connections, and send a chat request to the
999other client."
1000 (interactive "sNick: ")
1001 (when (null pproc) (if (processp erc-server-process)
1002 (setq pproc erc-server-process)
1003 (error "Can not find parent process")))
1004 (let* ((sproc (erc-dcc-server "dcc-chat-out"
1005 'erc-dcc-chat-filter
1006 'erc-dcc-chat-sentinel))
1007 (contact (process-contact sproc)))
1008 (erc-dcc-list-add 'OCHAT nick sproc pproc)
1009 (process-send-string pproc
1010 (format "PRIVMSG %s :\C-aDCC CHAT chat %s %d\C-a\n"
1011 nick
1012 (erc-ip-to-decimal (nth 0 contact)) (nth 1 contact)))))
1013
1014(defvar erc-dcc-from)
1015(make-variable-buffer-local 'erc-dcc-from)
1016
1017(defvar erc-dcc-unprocessed-output)
1018(make-variable-buffer-local 'erc-dcc-unprocessed-output)
1019
1020(defun erc-dcc-chat-setup (entry)
1021 "Setup a DCC chat buffer, returning the buffer."
1022 (let* ((nick (erc-extract-nick (plist-get entry :nick)))
1023 (buffer (generate-new-buffer
1024 (format erc-dcc-chat-buffer-name-format nick)))
1025 (proc (plist-get entry :peer))
1026 (parent-proc (plist-get entry :parent)))
1027 (erc-setup-buffer buffer)
1028 ;; buffer is now the current buffer.
1029 (erc-dcc-chat-mode)
1030 (setq erc-server-process parent-proc)
1031 (setq erc-dcc-from nick)
1032 (setq erc-dcc-entry-data entry)
1033 (setq erc-dcc-unprocessed-output "")
1034 (setq erc-insert-marker (set-marker (make-marker) (point-max)))
1035 (erc-display-prompt buffer (point-max))
1036 (set-process-buffer proc buffer)
1037 (add-hook 'kill-buffer-hook 'erc-dcc-chat-buffer-killed nil t)
1038 (run-hook-with-args 'erc-dcc-chat-connect-hook proc)
1039 buffer))
1040
1041(defun erc-dcc-chat-accept (entry parent-proc)
1042 "Accept an incoming DCC connection and open a DCC window"
1043 (let* ((nick (erc-extract-nick (plist-get entry :nick)))
1044 buffer proc)
1045 (setq proc
1046 (funcall erc-dcc-connect-function
1047 "dcc-chat" nil
1048 (plist-get entry :ip)
1049 (string-to-number (plist-get entry :port))
1050 entry))
1051 ;; XXX: connected, should we kill the ip/port properties?
1052 (setq entry (plist-put entry :peer proc))
1053 (setq entry (plist-put entry :parent parent-proc))
1054 (set-process-filter proc 'erc-dcc-chat-filter)
1055 (set-process-sentinel proc 'erc-dcc-chat-sentinel)
1056 (setq buffer (erc-dcc-chat-setup entry))))
1057
1058(defun erc-dcc-chat-filter (proc str)
1059 (let ((orig-buffer (current-buffer)))
1060 (unwind-protect
1061 (progn
1062 (set-buffer (process-buffer proc))
1063 (setq erc-dcc-unprocessed-output
1064 (concat erc-dcc-unprocessed-output str))
1065 (run-hook-with-args 'erc-dcc-chat-filter-hook proc
1066 erc-dcc-unprocessed-output))
1067 (set-buffer orig-buffer))))
1068
1069(defun erc-dcc-chat-parse-output (proc str)
1070 (save-match-data
1071 (let ((posn 0)
1072 line)
1073 (while (string-match "\n" str posn)
1074 (setq line (substring str posn (match-beginning 0)))
1075 (setq posn (match-end 0))
1076 (erc-display-message
1077 nil nil proc
1078 'dcc-chat-privmsg ?n (erc-propertize erc-dcc-from 'face
1079 'erc-nick-default-face) ?m line))
1080 (setq erc-dcc-unprocessed-output (substring str posn)))))
1081
1082(defun erc-dcc-chat-buffer-killed ()
1083 (erc-dcc-chat-close "killed buffer"))
1084
1085(defun erc-dcc-chat-close (&optional event)
1086 "Close a DCC chat, removing any associated processes and tidying up
1087`erc-dcc-list'"
1088 (let ((proc (plist-get erc-dcc-entry-data :peer))
1089 (evt (or event "")))
1090 (when proc
1091 (setq erc-dcc-list (delq erc-dcc-entry-data erc-dcc-list))
1092 (run-hook-with-args 'erc-dcc-chat-exit-hook proc)
1093 (delete-process proc)
1094 (erc-display-message
1095 nil 'notice erc-server-process
1096 'dcc-chat-ended ?n erc-dcc-from ?t (current-time-string) ?e evt)
1097 (setq erc-dcc-entry-data (plist-put erc-dcc-entry-data :peer nil)))))
1098
1099(defun erc-dcc-chat-sentinel (proc event)
1100 (let ((buf (current-buffer))
1101 (elt (erc-dcc-member :peer proc)))
1102 ;; the sentinel is also notified when the connection is opened, so don't
1103 ;; immediately kill it again
1104 ;(message "buf %s elt %S evt %S" buf elt event)
1105 (unwind-protect
1106 (if (string-match "^open from" event)
1107 (erc-dcc-chat-setup elt)
1108 (erc-dcc-chat-close event))
1109 (set-buffer buf))))
1110
1111(defun erc-dcc-no-such-nick (proc parsed)
1112 "Detect and handle no-such-nick replies from the IRC server."
1113 (let* ((elt (erc-dcc-member :nick (second (erc-response.command-args parsed))
1114 :parent proc))
1115 (peer (plist-get elt :peer)))
1116 (when (or (and (processp peer) (not (eq (process-status peer) 'open)))
1117 elt)
1118 ;; Since we already created an entry before sending the CTCP
1119 ;; message, we now remove it, if it doesn't point to a process
1120 ;; which is already open.
1121 (setq erc-dcc-list (delq elt erc-dcc-list))
1122 (if (processp peer) (delete-process peer)))
1123 nil))
1124
1125(add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)
1126
1127(provide 'erc-dcc)
1128
1129;;; erc-dcc.el ends here
1130;;
1131;; Local Variables:
1132;; indent-tabs-mode: nil
1133;; End:
1134
1135;; arch-tag: cda5a6b3-c510-4dbe-b699-84cccfa04edb
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
new file mode 100644
index 00000000000..59e80b60b8d
--- /dev/null
+++ b/lisp/erc/erc-ezbounce.el
@@ -0,0 +1,180 @@
1;;; erc-ezbounce.el --- Handle EZBounce bouncer commands
2
3;; Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Andreas Fuchs <asf@void.at>
6;; Keywords: comm
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;;; Code:
28
29(require 'erc)
30(eval-when-compile (require 'cl))
31
32(defgroup erc-ezbounce nil
33 "Interface to the EZBounce IRC bouncer (a virtual IRC server)"
34 :group 'erc)
35
36(defcustom erc-ezb-regexp "^ezbounce!srv$"
37 "Regexp used by the EZBouncer to identify itself to the user."
38 :group 'erc-ezbounce
39 :type 'string)
40
41(defcustom erc-ezb-login-alist '()
42 "Alist of logins suitable for the server we're connecting to.
43
44The alist's format is as follows:
45
46 (((server . port) . (username . password))
47 ((server . port) . (username . password))
48 ...)"
49 :group 'erc-ezbounce
50 :type '(repeat
51 (cons (cons :tag "Server"
52 string
53 string)
54 (cons :tag "Login"
55 string
56 string))))
57
58(defvar erc-ezb-action-alist '(("^\\[awaiting login/pass command\\]$" . erc-ezb-identify)
59 ("^\\[use /quote CONN <server> to connect\\]$" . erc-ezb-select)
60 ("^ID +IRC NICK +TO +TIME$" . erc-ezb-init-session-list)
61 ("^$" . erc-ezb-end-of-session-list)
62 (".*" . erc-ezb-add-session))
63 "Alist of actions to take on NOTICEs from EZBounce.")
64
65
66(defvar erc-ezb-session-list '()
67 "List of detached EZBounce sessions.")
68(make-variable-buffer-local 'erc-ezb-session-list)
69
70(defvar erc-ezb-inside-session-listing nil
71 "Indicate whether current notices are expected to be EZB session listings.")
72
73;;;###autoload
74(defun erc-cmd-ezb (line &optional force)
75 "Send EZB commands to the EZBouncer verbatim."
76 (erc-server-send (concat "EZB " line)))
77(put 'erc-cmd-EZB 'do-not-parse-args t)
78
79;;;###autoload
80(defun erc-ezb-get-login (server port)
81 "Return an appropriate EZBounce login for SERVER and PORT.
82Look up entries in `erc-ezb-login-alist'. If the username or password
83in the alist is `nil', prompt for the appropriate values."
84 (let ((login (cdr (assoc (cons server port) erc-ezb-login-alist))))
85 (when login
86 (let ((username (car login))
87 (password (cdr login)))
88 (when (null username)
89 (setq username (read-from-minibuffer (format "EZBounce user name for %s:%s: " server port))))
90 (when (null password)
91 (setq password (read-passwd (format "EZBounce password for %s:%s: " server port))))
92 (cons username password)))))
93
94;;;###autoload
95(defun erc-ezb-lookup-action (message)
96 (let ((function-alist erc-ezb-action-alist)
97 found)
98 (while (and (not found)
99 function-alist)
100 (let ((regexp (caar function-alist))
101 (function (cdar function-alist)))
102 (when (string-match regexp message)
103 (setq found function))
104 (setq function-alist (cdr function-alist))))
105 found))
106
107;;;###autoload
108(defun erc-ezb-notice-autodetect (proc parsed)
109 "React on an EZBounce NOTICE request."
110 (let* ((sender (erc-response.sender parsed))
111 (message (erc-response.contents parsed))
112 (function (erc-ezb-lookup-action message)))
113 (when (and (string-match erc-ezb-regexp sender)
114 function)
115 (funcall function message)))
116 nil)
117
118;;;###autoload
119(defun erc-ezb-identify (message)
120 "Identify to the EZBouncer server."
121 (let ((login (erc-ezb-get-login erc-session-server (erc-port-to-string erc-session-port))))
122 (unless (null login)
123 (let ((username (car login))
124 (pass (cdr login)))
125 (erc-server-send (concat "LOGIN " username " " pass))))))
126
127;;;###autoload
128(defun erc-ezb-init-session-list (message)
129 "Reset the EZBounce session list to NIL."
130 (setq erc-ezb-session-list nil)
131 (setq erc-ezb-inside-session-listing t))
132
133;;;###autoload
134(defun erc-ezb-end-of-session-list (message)
135 "Indicate the end of the EZBounce session listing."
136 (setq erc-ezb-inside-session-listing nil))
137
138;;;###autoload
139(defun erc-ezb-add-session (message)
140 "Add an EZBounce session to the session list."
141 (when (and erc-ezb-inside-session-listing
142 (string-match "^\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\)$" message))
143 (let ((id (match-string 1 message))
144 (nick (match-string 2 message))
145 (to (match-string 3 message)))
146 (add-to-list 'erc-ezb-session-list (list id nick to)))))
147
148;;;###autoload
149(defun erc-ezb-select (message)
150 "Select an IRC server to use by EZBounce, in ERC style."
151 (unless (and erc-ezb-session-list
152 (erc-ezb-select-session))
153 (let* ((server (read-from-minibuffer
154 "IRC server: " "" nil nil 'erc-server-history-list))
155 (port
156 (erc-string-to-port
157 (read-from-minibuffer "IRC port: "
158 (erc-port-to-string "6667")))))
159 (erc-server-send (format "CONN %s %s" server port)))))
160
161
162;;;###autoload
163(defun erc-ezb-select-session ()
164 "Select a detached EZBounce session."
165 (let ((session (completing-read "Existing Session (RET to enter a new one): "
166 erc-ezb-session-list)))
167 (if (string= session "")
168 nil
169 (erc-server-send (format "REATTACH %s" session)))))
170
171
172;;;###autoload
173(defun erc-ezb-initialize ()
174 "Add EZBouncer convenience functions to ERC."
175 (add-hook 'erc-server-NOTICE-functions 'erc-ezb-notice-autodetect))
176
177(provide 'erc-ezbounce)
178
179;; arch-tag: e972aa7b-a9f4-4d16-a489-074ec7a1002e
180;;; erc-ezbounce.el ends here
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
new file mode 100644
index 00000000000..f945d838c2a
--- /dev/null
+++ b/lisp/erc/erc-fill.el
@@ -0,0 +1,197 @@
1;;; erc-fill.el --- Filling IRC messages in various ways
2
3;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Andreas Fuchs <asf@void.at>
6;; Mario Lang <mlang@delysid.org>
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcFilling
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This package implements filling of messages sent and received. Use
29;; `erc-fill-mode' to switch it on. Customize `erc-fill-function' to
30;; change the style.
31
32;;; Code:
33
34(require 'erc)
35(require 'erc-stamp); for the timestamp stuff
36
37(defgroup erc-fill nil
38 "Filling means to reformat long lines in different ways."
39 :group 'erc)
40
41;;;###autoload (autoload 'erc-fill-mode "erc-fill" nil t)
42(erc-define-minor-mode erc-fill-mode
43 "Toggle ERC fill mode.
44With numeric arg, turn ERC fill mode on if and only if arg is
45positive. In ERC fill mode, messages in the channel buffers are
46filled."
47 nil nil nil
48 :global t :group 'erc-fill
49 (if erc-fill-mode
50 (erc-fill-enable)
51 (erc-fill-disable)))
52
53(defun erc-fill-enable ()
54 "Setup hooks for `erc-fill-mode'."
55 (interactive)
56 (add-hook 'erc-insert-modify-hook 'erc-fill)
57 (add-hook 'erc-send-modify-hook 'erc-fill))
58
59(defun erc-fill-disable ()
60 "Cleanup hooks, disable `erc-fill-mode'."
61 (interactive)
62 (remove-hook 'erc-insert-modify-hook 'erc-fill)
63 (remove-hook 'erc-send-modify-hook 'erc-fill))
64
65(defcustom erc-fill-prefix nil
66 "Values used as `fill-prefix' for `erc-fill-variable'.
67nil means fill with space, a string means fill with this string."
68 :group 'erc-fill
69 :type '(choice (const nil) string))
70
71(defcustom erc-fill-function 'erc-fill-variable
72 "Function to use for filling messages.
73
74Variable Filling with an `erc-fill-prefix' of nil:
75
76<shortnick> this is a very very very long message with no
77 meaning at all
78
79Variable Filling with an `erc-fill-prefix' of four spaces:
80
81<shortnick> this is a very very very long message with no
82 meaning at all
83
84Static Filling with `erc-fill-static-center' of 27:
85
86 <shortnick> foo bar baz
87 <a-very-long-nick> foo bar baz quuuuux
88 <shortnick> this is a very very very long message with no
89 meaning at all
90
91These two styles are implemented using `erc-fill-variable' and
92`erc-fill-static'. You can, of course, define your own filling
93function. Narrowing to the region in question is in effect while your
94function is called."
95 :group 'erc-fill
96 :type '(choice (const :tag "Variable Filling" erc-fill-variable)
97 (const :tag "Static Filling" erc-fill-static)
98 function))
99
100(defcustom erc-fill-static-center 27
101 "Column around which all statically filled messages will be
102centered. This column denotes the point where the ' ' character
103between <nickname> and the entered text will be put, thus aligning
104nick names right and text left."
105 :group 'erc-fill
106 :type 'integer)
107
108(defcustom erc-fill-variable-maximum-indentation 17
109 "If we indent a line after a long nick, don't indent more then this
110characters. Set to nil to disable."
111 :group 'erc-fill
112 :type 'integer)
113
114(defcustom erc-fill-column 78
115 "The column at which a filled paragraph is broken."
116 :group 'erc-fill
117 :type 'integer)
118
119;;;###autoload
120(defun erc-fill ()
121 "Fill a region using the function referenced in `erc-fill-function'.
122You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
123 (unless (erc-string-invisible-p (buffer-substring (point-min) (point-max)))
124 (when erc-fill-function
125 (funcall erc-fill-function))))
126
127(defun erc-fill-static ()
128 "Fills a text such that messages start at column `erc-fill-static-center'."
129 (save-match-data
130 (goto-char (point-min))
131 (looking-at "^\\(\\S-+\\)")
132 (let ((nick (match-string 1)))
133 (let ((fill-column (- erc-fill-column (erc-timestamp-offset)))
134 (fill-prefix (make-string erc-fill-static-center 32)))
135 (insert (make-string (max 0 (- erc-fill-static-center
136 (length nick) 1))
137 32))
138 (erc-fill-regarding-timestamp))
139 (erc-restore-text-properties))))
140
141(defun erc-fill-variable ()
142 "Fill from `point-min' to `point-max'."
143 (let ((fill-prefix erc-fill-prefix)
144 (fill-column (or erc-fill-column fill-column)))
145 (goto-char (point-min))
146 (if fill-prefix
147 (let ((first-line-offset (make-string (erc-timestamp-offset) 32)))
148 (insert first-line-offset)
149 (fill-region (point-min) (point-max) t t)
150 (goto-char (point-min))
151 (delete-char (length first-line-offset)))
152 (save-match-data
153 (let* ((nickp (looking-at "^\\(\\S-+\\)"))
154 (nick (if nickp
155 (match-string 1)
156 ""))
157 (fill-column (- erc-fill-column (erc-timestamp-offset)))
158 (fill-prefix (make-string (min (+ 1 (length nick))
159 (- fill-column 1)
160 (or erc-fill-variable-maximum-indentation
161 fill-column))
162 32)))
163 (erc-fill-regarding-timestamp))))
164 (erc-restore-text-properties)))
165
166(defun erc-fill-regarding-timestamp ()
167 "Fills a text such that messages start at column `erc-fill-static-center'."
168 (fill-region (point-min) (point-max) t t)
169 (goto-char (point-min))
170 (forward-line)
171 (indent-rigidly (point) (point-max) (erc-timestamp-offset)))
172
173(defun erc-timestamp-offset ()
174 "Get length of timestamp if inserted left."
175 (if (and (boundp 'erc-timestamp-format)
176 erc-timestamp-format
177 (eq erc-insert-timestamp-function 'erc-insert-timestamp-left)
178 (not erc-hide-timestamps))
179 (length (format-time-string erc-timestamp-format))
180 0))
181
182(defun erc-restore-text-properties ()
183 "Restore the property 'erc-parsed for the region."
184 (let* ((parsed-posn (text-property-not-all (point-min) (point-max)
185 'erc-parsed nil))
186 (parsed-prop (when parsed-posn
187 (get-text-property parsed-posn 'erc-parsed))))
188 (put-text-property (point-min) (point-max) 'erc-parsed parsed-prop)))
189
190(provide 'erc-fill)
191
192;;; erc-fill.el ends here
193;; Local Variables:
194;; indent-tabs-mode: nil
195;; End:
196
197;; arch-tag: 89224581-c2c2-4e26-92e5-e3a390dc516a
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
new file mode 100644
index 00000000000..dbbdaacc141
--- /dev/null
+++ b/lisp/erc/erc-goodies.el
@@ -0,0 +1,522 @@
1;; erc-goodies.el --- Collection of ERC modules
2
3;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation
4
5;; Author: Jorgen Schaefer <forcer@forcix.cx>
6
7;; Most code is taken verbatim from erc.el, see there for the original
8;; authors.
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28
29;; This provides some small but still useful modes for ERC.
30
31;;; Code:
32
33(require 'erc)
34
35;; Imenu Autoload
36(add-hook 'erc-mode-hook
37 (lambda ()
38 (setq imenu-create-index-function 'erc-create-imenu-index)))
39(autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
40
41;;; Automatically scroll to bottom
42(defcustom erc-input-line-position nil
43 "Specify where to position the input line when using `erc-scroll-to-bottom'.
44
45This should be an integer specifying the line of the buffer on which
46the input line should stay. A value of \"-1\" would keep the input
47line positioned on the last line in the buffer. This is passed as an
48argument to `recenter'."
49 :group 'erc-display
50 :type '(choice integer (const nil)))
51
52(define-erc-module scrolltobottom nil
53 "This mode causes the prompt to stay at the end of the window.
54You have to activate or deactivate it in already created windows
55separately."
56 ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom))
57 ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)))
58
59(defun erc-add-scroll-to-bottom ()
60 "A hook function for `erc-mode-hook' to recenter output at bottom of window.
61
62If you find that ERC hangs when using this function, try customizing
63the value of `erc-input-line-position'.
64
65This works whenever scrolling happens, so it's added to
66`window-scroll-functions' rather than `erc-insert-post-hook'."
67 ;;(make-local-hook 'window-scroll-functions)
68 (add-hook 'window-scroll-functions 'erc-scroll-to-bottom nil t))
69
70(defun erc-scroll-to-bottom (window display-start)
71 "Recenter WINDOW so that `point' is on the last line.
72
73This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'.
74
75You can control which line is recentered to by customizing the
76variable `erc-input-line-position'.
77
78DISPLAY-START is ignored."
79 (if (and window (window-live-p window))
80 ;; Temporarily bind resize-mini-windows to nil so that users who have it
81 ;; set to a non-nil value will not suffer from premature minibuffer
82 ;; shrinkage due to the below recenter call. I have no idea why this
83 ;; works, but it solves the problem, and has no negative side effects.
84 ;; (Fran Litterio, 2003/01/07)
85 (let ((resize-mini-windows nil))
86 (save-selected-window
87 (select-window window)
88 (save-restriction
89 (widen)
90 (when (and erc-insert-marker
91 ;; we're editing a line. Scroll.
92 (> (point) erc-insert-marker))
93 (save-excursion
94 (goto-char (point-max))
95 (recenter (or erc-input-line-position -1))
96 (sit-for 0))))))))
97
98;;; Make read only
99(define-erc-module readonly nil
100 "This mode causes all inserted text to be read-only."
101 ((add-hook 'erc-insert-post-hook 'erc-make-read-only)
102 (add-hook 'erc-send-post-hook 'erc-make-read-only))
103 ((remove-hook 'erc-insert-post-hook 'erc-make-read-only)
104 (remove-hook 'erc-send-post-hook 'erc-make-read-only)))
105
106(defun erc-make-read-only ()
107 "Make all the text in the current buffer read-only.
108Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
109 (put-text-property (point-min) (point-max) 'read-only t)
110 (put-text-property (point-min) (point-max) 'front-sticky t)
111 (put-text-property (point-min) (point-max) 'rear-nonsticky t))
112
113;; Distingush non-commands
114(defvar erc-noncommands-list '(erc-cmd-ME
115 erc-cmd-COUNTRY
116 erc-cmd-SV
117 erc-cmd-SM
118 erc-cmd-SMV
119 erc-cmd-LASTLOG)
120 "List of commands that are aliases for CTCP ACTION or for erc messages.
121
122If a command's function symbol is in this list, the typed command
123does not appear in the ERC buffer after the user presses ENTER.")
124
125(define-erc-module noncommands nil
126 "This mode distinguishies non-commands.
127Commands listed in `erc-insert-this' know how to display
128themselves."
129 ((add-hook 'erc-send-pre-hook 'erc-send-distinguish-noncommands))
130 ((remove-hook 'erc-send-pre-hook 'erc-send-distinguish-noncommands)))
131
132(defun erc-send-distinguish-noncommands (str)
133 "If STR is an ERC non-command, set `erc-insert-this' to nil."
134 (let* ((command (erc-extract-command-from-line str))
135 (cmd-fun (and command
136 (car command))))
137 (when (and cmd-fun
138 (not (string-match "\n.+$" str))
139 (memq cmd-fun erc-noncommands-list))
140 (setq erc-insert-this nil))))
141
142;;; IRC control character processing.
143(defgroup erc-control-characters nil
144 "Dealing with control characters"
145 :group 'erc)
146
147(defcustom erc-interpret-controls-p t
148 "*If non-nil, display IRC colours and other highlighting effects.
149
150If this is set to the symbol `remove', ERC removes all IRC colors and
151highlighting effects. When this variable is non-nil, it can cause Emacs to run
152slowly on systems lacking sufficient CPU speed. In chatty channels, or in an
153emergency (message flood) it can be turned off to save processing time. See
154`erc-toggle-interpret-controls'."
155 :group 'erc-control-characters
156 :type '(choice (const :tag "Highlight control characters" t)
157 (const :tag "Remove control characters" remove)
158 (const :tag "Display raw control characters" nil)))
159
160(defcustom erc-interpret-mirc-color nil
161 "*If non-nil, erc will interpret mIRC color codes."
162 :group 'erc-control-characters
163 :type 'boolean)
164
165(defcustom erc-beep-p nil
166 "Beep if C-g is in the server message.
167The value `erc-interpret-controls-p' must also be t for this to work."
168 :group 'erc-control-characters
169 :type 'boolean)
170
171(defface erc-bold-face '((t (:bold t)))
172 "ERC bold face."
173 :group 'erc-faces)
174(defface erc-inverse-face
175 '((t (:foreground "White" :background "Black")))
176 "ERC inverse face."
177 :group 'erc-faces)
178(defface erc-underline-face '((t (:underline t)))
179 "ERC underline face."
180 :group 'erc-faces)
181
182(defface fg:erc-color-face0 '((t (:foreground "White")))
183 "ERC face."
184 :group 'erc-faces)
185(defface fg:erc-color-face1 '((t (:foreground "black")))
186 "ERC face."
187 :group 'erc-faces)
188(defface fg:erc-color-face2 '((t (:foreground "blue4")))
189 "ERC face."
190 :group 'erc-faces)
191(defface fg:erc-color-face3 '((t (:foreground "green4")))
192 "ERC face."
193 :group 'erc-faces)
194(defface fg:erc-color-face4 '((t (:foreground "red")))
195 "ERC face."
196 :group 'erc-faces)
197(defface fg:erc-color-face5 '((t (:foreground "brown")))
198 "ERC face."
199 :group 'erc-faces)
200(defface fg:erc-color-face6 '((t (:foreground "purple")))
201 "ERC face."
202 :group 'erc-faces)
203(defface fg:erc-color-face7 '((t (:foreground "orange")))
204 "ERC face."
205 :group 'erc-faces)
206(defface fg:erc-color-face8 '((t (:foreground "yellow")))
207 "ERC face."
208 :group 'erc-faces)
209(defface fg:erc-color-face9 '((t (:foreground "green")))
210 "ERC face."
211 :group 'erc-faces)
212(defface fg:erc-color-face10 '((t (:foreground "lightblue1")))
213 "ERC face."
214 :group 'erc-faces)
215(defface fg:erc-color-face11 '((t (:foreground "cyan")))
216 "ERC face."
217 :group 'erc-faces)
218(defface fg:erc-color-face12 '((t (:foreground "blue")))
219 "ERC face."
220 :group 'erc-faces)
221(defface fg:erc-color-face13 '((t (:foreground "deeppink")))
222 "ERC face."
223 :group 'erc-faces)
224(defface fg:erc-color-face14 '((t (:foreground "gray50")))
225 "ERC face."
226 :group 'erc-faces)
227(defface fg:erc-color-face15 '((t (:foreground "gray90")))
228 "ERC face."
229 :group 'erc-faces)
230
231(defface bg:erc-color-face0 '((t (:background "White")))
232 "ERC face."
233 :group 'erc-faces)
234(defface bg:erc-color-face1 '((t (:background "black")))
235 "ERC face."
236 :group 'erc-faces)
237(defface bg:erc-color-face2 '((t (:background "blue4")))
238 "ERC face."
239 :group 'erc-faces)
240(defface bg:erc-color-face3 '((t (:background "green4")))
241 "ERC face."
242 :group 'erc-faces)
243(defface bg:erc-color-face4 '((t (:background "red")))
244 "ERC face."
245 :group 'erc-faces)
246(defface bg:erc-color-face5 '((t (:background "brown")))
247 "ERC face."
248 :group 'erc-faces)
249(defface bg:erc-color-face6 '((t (:background "purple")))
250 "ERC face."
251 :group 'erc-faces)
252(defface bg:erc-color-face7 '((t (:background "orange")))
253 "ERC face."
254 :group 'erc-faces)
255(defface bg:erc-color-face8 '((t (:background "yellow")))
256 "ERC face."
257 :group 'erc-faces)
258(defface bg:erc-color-face9 '((t (:background "green")))
259 "ERC face."
260 :group 'erc-faces)
261(defface bg:erc-color-face10 '((t (:background "lightblue1")))
262 "ERC face."
263 :group 'erc-faces)
264(defface bg:erc-color-face11 '((t (:background "cyan")))
265 "ERC face."
266 :group 'erc-faces)
267(defface bg:erc-color-face12 '((t (:background "blue")))
268 "ERC face."
269 :group 'erc-faces)
270(defface bg:erc-color-face13 '((t (:background "deeppink")))
271 "ERC face."
272 :group 'erc-faces)
273(defface bg:erc-color-face14 '((t (:background "gray50")))
274 "ERC face."
275 :group 'erc-faces)
276(defface bg:erc-color-face15 '((t (:background "gray90")))
277 "ERC face."
278 :group 'erc-faces)
279
280(defun erc-get-bg-color-face (n)
281 "Fetches the right face for background color N (0-15)."
282 (if (stringp n) (setq n (string-to-number n)))
283 (if (not (numberp n))
284 (progn
285 (message "erc-get-bg-color-face: n is NaN: %S" n)
286 (beep)
287 'default)
288 (when (> n 16)
289 (erc-log (format " Wrong color: %s" n))
290 (setq n (mod n 16)))
291 (cond
292 ((and (>= n 0) (< n 16))
293 (intern (concat "bg:erc-color-face" (number-to-string n))))
294 (t (erc-log (format " Wrong color: %s" n)) 'default))))
295
296(defun erc-get-fg-color-face (n)
297 "Fetches the right face for foreground color N (0-15)."
298 (if (stringp n) (setq n (string-to-number n)))
299 (if (not (numberp n))
300 (progn
301 (message "erc-get-fg-color-face: n is NaN: %S" n)
302 (beep)
303 'default)
304 (when (> n 16)
305 (erc-log (format " Wrong color: %s" n))
306 (setq n (mod n 16)))
307 (cond
308 ((and (>= n 0) (< n 16))
309 (intern (concat "fg:erc-color-face" (number-to-string n))))
310 (t (erc-log (format " Wrong color: %s" n)) 'default))))
311
312(define-erc-module irccontrols nil
313 "This mode enables the interpretation of IRC control chars."
314 ((add-hook 'erc-insert-modify-hook 'erc-controls-highlight)
315 (add-hook 'erc-send-modify-hook 'erc-controls-highlight))
316 ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight)
317 (remove-hook 'erc-send-modify-hook 'erc-controls-highlight)))
318
319(defun erc-controls-interpret (str)
320 "Return a copy of STR after dealing with IRC control characters.
321See `erc-interpret-controls-p' and `erc-interpret-mirc-color' for options."
322 (when str
323 (let ((s str))
324 (cond ((eq erc-interpret-controls-p 'remove)
325 (erc-controls-strip s))
326 (erc-interpret-controls-p
327 (let ((boldp nil)
328 (inversep nil)
329 (underlinep nil)
330 (fg nil)
331 (bg nil))
332 (while (string-match erc-controls-highlight-regexp s)
333 (let ((control (match-string 1 s))
334 (fg-color (match-string 2 s))
335 (bg-color (match-string 4 s))
336 (start (match-beginning 0))
337 (end (+ (match-beginning 0)
338 (length (match-string 5 s)))))
339 (setq s (erc-replace-match-subexpression-in-string
340 "" s control 1 start))
341 (cond ((and erc-interpret-mirc-color (or fg-color bg-color))
342 (setq fg fg-color)
343 (setq bg bg-color))
344 ((string= control "\C-b")
345 (setq boldp (not boldp)))
346 ((string= control "\C-v")
347 (setq inversep (not inversep)))
348 ((string= control "\C-_")
349 (setq underlinep (not underlinep)))
350 ((string= control "\C-c")
351 (setq fg nil
352 bg nil))
353 ((string= control "\C-g")
354 (when erc-beep-p
355 (ding)))
356 ((string= control "\C-o")
357 (setq boldp nil
358 inversep nil
359 underlinep nil
360 fg nil
361 bg nil))
362 (t nil))
363 (erc-controls-propertize
364 start end boldp inversep underlinep fg bg s)))
365 s))
366 (t s)))))
367
368(defun erc-controls-strip (str)
369 "Return a copy of STR with all IRC control characters removed."
370 (when str
371 (let ((s str))
372 (while (string-match erc-controls-remove-regexp s)
373 (setq s (replace-match "" nil nil s)))
374 s)))
375
376(defvar erc-controls-remove-regexp
377 "\C-b\\|\C-_\\|\C-v\\|\C-g\\|\C-o\\|\C-c[0-9]?[0-9]?\\(,[0-9][0-9]?\\)?"
378 "Regular expression which matches control characters to remove.")
379
380(defvar erc-controls-highlight-regexp
381 (concat "\\(\C-b\\|\C-v\\|\C-_\\|\C-g\\|\C-o\\|"
382 "\C-c\\([0-9][0-9]?\\)?\\(,\\([0-9][0-9]?\\)\\)?\\)"
383 "\\([^\C-b\C-v\C-_\C-c\C-g\C-o\n]*\\)")
384 "Regular expression which matches control chars and the text to highlight.")
385
386(defun erc-controls-highlight ()
387 "Highlight IRC control chars in the buffer.
388This is useful for `erc-insert-modify-hook' and
389`erc-send-modify-hook'. Also see `erc-interpret-controls-p' and
390`erc-interpret-mirc-color'."
391 (goto-char (point-min))
392 (cond ((eq erc-interpret-controls-p 'remove)
393 (while (re-search-forward erc-controls-remove-regexp nil t)
394 (replace-match "")))
395 (erc-interpret-controls-p
396 (let ((boldp nil)
397 (inversep nil)
398 (underlinep nil)
399 (fg nil)
400 (bg nil))
401 (while (re-search-forward erc-controls-highlight-regexp nil t)
402 (let ((control (match-string 1))
403 (fg-color (match-string 2))
404 (bg-color (match-string 4))
405 (start (match-beginning 0))
406 (end (+ (match-beginning 0) (length (match-string 5)))))
407 (replace-match "" nil nil nil 1)
408 (cond ((and erc-interpret-mirc-color (or fg-color bg-color))
409 (setq fg fg-color)
410 (setq bg bg-color))
411 ((string= control "\C-b")
412 (setq boldp (not boldp)))
413 ((string= control "\C-v")
414 (setq inversep (not inversep)))
415 ((string= control "\C-_")
416 (setq underlinep (not underlinep)))
417 ((string= control "\C-c")
418 (setq fg nil
419 bg nil))
420 ((string= control "\C-g")
421 (when erc-beep-p
422 (ding)))
423 ((string= control "\C-o")
424 (setq boldp nil
425 inversep nil
426 underlinep nil
427 fg nil
428 bg nil))
429 (t nil))
430 (erc-controls-propertize start end
431 boldp inversep underlinep fg bg)))))
432 (t nil)))
433
434(defun erc-controls-propertize (from to boldp inversep underlinep fg bg
435 &optional str)
436 "Prepend properties from IRC control characters between FROM and TO.
437If optional argument STR is provided, apply to STR, otherwise prepend properties
438to a region in the current buffer."
439 (font-lock-prepend-text-property
440 from
441 to
442 'face
443 (append (if boldp
444 '(erc-bold-face)
445 nil)
446 (if inversep
447 '(erc-inverse-face)
448 nil)
449 (if underlinep
450 '(erc-underline-face)
451 nil)
452 (if fg
453 (list (erc-get-fg-color-face fg))
454 nil)
455 (if bg
456 (list (erc-get-bg-color-face bg))
457 nil))
458 str)
459 str)
460
461(defun erc-toggle-interpret-controls (&optional arg)
462 "Toggle interpretation of control sequences in messages.
463
464If ARG is positive, interpretation is turned on.
465Else interpretation is turned off."
466 (interactive "P")
467 (cond ((and (numberp arg) (> arg 0))
468 (setq erc-interpret-controls-p t))
469 (arg (setq erc-interpret-controls-p nil))
470 (t (setq erc-interpret-controls-p (not erc-interpret-controls-p))))
471 (message "ERC color interpretation %s"
472 (if erc-interpret-controls-p "ON" "OFF")))
473
474;; Smiley
475(define-erc-module smiley nil
476 "This mode translates text-smileys such as :-) into pictures.
477This requires the function `smiley-region', which is defined in
478smiley.el, which is part of Gnus."
479 ((add-hook 'erc-insert-modify-hook 'erc-smiley)
480 (add-hook 'erc-send-modify-hook 'erc-smiley))
481 ((remove-hook 'erc-insert-modify-hook 'erc-smiley)
482 (remove-hook 'erc-send-modify-hook 'erc-smiley)))
483
484(defun erc-smiley ()
485 "Smilify a region.
486This function should be used with `erc-insert-modify-hook'."
487 (when (fboundp 'smiley-region)
488 (smiley-region (point-min) (point-max))))
489
490;; Unmorse
491(define-erc-module unmorse nil
492 "This mode causes morse code in the current channel to be unmorsed."
493 ((add-hook 'erc-insert-modify-hook 'erc-unmorse))
494 ((remove-hook 'erc-insert-modify-hook 'erc-unmorse)))
495
496(defun erc-unmorse ()
497 "Unmorse some text.
498Add this to `erc-insert-modify-hook' if you happen to be on a
499channel that has weird people talking in morse to each other.
500
501See also `unmorse-region'."
502 (goto-char (point-min))
503 (when (re-search-forward "[.-]+\\([.-]+[/ ]\\)+[.-]+" nil t)
504 (unmorse-region (match-beginning 0) (match-end 0))))
505
506;;; erc-occur
507(defun erc-occur (string &optional proc)
508 "Search for STRING in all buffers related to current server.
509If called interactively and prefix argument is given, search on all connected
510servers. If called from a program, PROC specifies the server process."
511 (interactive
512 (list (read-string "Search for: ")
513 (if current-prefix-arg
514 nil erc-server-process)))
515 (if (fboundp 'multi-occur)
516 (multi-occur (erc-buffer-list nil proc) string)
517 (error "`multi-occur' is not defined as a function")))
518
519(provide 'erc-goodies)
520
521;; arch-tag: d987ae26-9e28-4c72-9596-e617309fb582
522;;; erc-goodies.el ends here
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
new file mode 100644
index 00000000000..63ec7bcecb0
--- /dev/null
+++ b/lisp/erc/erc-ibuffer.el
@@ -0,0 +1,184 @@
1;;; erc-ibuffer.el --- ibuffer integration with ERC
2
3;; Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcIbuffer
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file contains code related to Ibuffer and ERC. Totally alpha,
29;; needs work. Usage: Type / C-e C-h when in Ibuffer-mode to see new
30;; limiting commands
31
32;;; Code:
33
34(require 'ibuffer)
35(require 'erc)
36
37(defgroup erc-ibuffer nil
38 "The Ibuffer group for ERC."
39 :group 'erc)
40
41(defcustom erc-ibuffer-keyword-char ?k
42 "Char used to indicate a channel which had keyword traffic lately (hidden)."
43 :group 'erc-ibuffer
44 :type 'character)
45(defcustom erc-ibuffer-pal-char ?p
46 "Char used to indicate a channel which had pal traffic lately (hidden)."
47 :group 'erc-ibuffer
48 :type 'character)
49(defcustom erc-ibuffer-fool-char ?f
50 "Char used to indicate a channel which had fool traffic lately (hidden)."
51 :group 'erc-ibuffer
52 :type 'character)
53(defcustom erc-ibuffer-dangerous-host-char ?d
54 "Char used to indicate a channel which had dangerous-host traffic lately (hidden)."
55 :group 'erc-ibuffer
56 :type 'character)
57
58(ibuffer-define-limiter erc-server
59 (:documentation
60 "Toggle current view to buffers which are related to ERC servers."
61 :description "erc servers"
62 :reader
63 (let ((regexp (read-from-minibuffer "Limit by server (regexp) (RET for all): ")))
64 (if (string= regexp "")
65 ".*"
66 regexp)))
67 (with-current-buffer buf
68 (and (eq major-mode 'erc-mode)
69 (string-match qualifier (or erc-server-announced-name
70 erc-session-server)))))
71
72(ibuffer-define-column erc-modified (:name "M")
73 (if (and (boundp 'erc-track-mode)
74 erc-track-mode)
75 (let ((entry (assq (current-buffer) erc-modified-channels-alist)))
76 (if entry
77 (if (> (length entry) 1)
78 (cond ((eq 'pal (nth 1 entry))
79 (string erc-ibuffer-pal-char))
80 ((eq 'fool (nth 1 entry))
81 (string erc-ibuffer-fool-char))
82 ((eq 'keyword (nth 1 entry))
83 (string erc-ibuffer-keyword-char))
84 ((eq 'dangerous-host (nth 1 entry))
85 (string erc-ibuffer-dangerous-host-char))
86 (t "$"))
87 (string ibuffer-modified-char))
88 " "))
89 " "))
90
91(ibuffer-define-column erc-server-name (:name "Server")
92 (if (and (boundp 'erc-server-process) (processp erc-server-process))
93 (with-current-buffer (process-buffer erc-server-process)
94 (or erc-server-announced-name erc-session-server))
95 ""))
96
97(ibuffer-define-column erc-target (:name "Target")
98 (if (eq major-mode 'erc-mode)
99 (cond ((and (boundp 'erc-server-process) (processp erc-server-process)
100 (eq (current-buffer) (process-buffer erc-server-process)))
101 (concat "Server " erc-session-server ":"
102 (erc-port-to-string erc-session-port)))
103 ((erc-channel-p (erc-default-target))
104 (concat (erc-default-target)))
105 ((erc-default-target)
106 (concat "Query: " (erc-default-target)))
107 (t "(parted)"))
108 (buffer-name)))
109
110(ibuffer-define-column erc-topic (:name "Topic")
111 (if (and (eq major-mode 'erc-mode)
112 erc-channel-topic)
113 (erc-controls-interpret erc-channel-topic)
114 ""))
115
116(ibuffer-define-column
117 erc-members (:name "Users")
118 (if (and (eq major-mode 'erc-mode)
119 (boundp 'erc-channel-users)
120 (hash-table-p erc-channel-users)
121 (> (hash-table-size erc-channel-users) 0))
122 (number-to-string (hash-table-size erc-channel-users))
123 ""))
124
125(ibuffer-define-column erc-away (:name "A")
126 (if (and (boundp 'erc-server-process)
127 (processp erc-server-process)
128 (with-current-buffer (process-buffer erc-server-process)
129 erc-away))
130 "A"
131 " "))
132
133(ibuffer-define-column
134 erc-op (:name "O")
135 (if (and (eq major-mode 'erc-mode)
136 (erc-channel-user-op-p (erc-current-nick)))
137 "@"
138 " "))
139
140(ibuffer-define-column erc-voice (:name "V")
141 (if (and (eq major-mode 'erc-mode)
142 (erc-channel-user-voice-p (erc-current-nick)))
143 "+"
144 " "))
145
146(ibuffer-define-column erc-channel-modes (:name "Mode")
147 (if (and (eq major-mode 'erc-mode)
148 (or (> (length erc-channel-modes) 0)
149 erc-channel-user-limit))
150 (concat (apply 'concat
151 "(+" erc-channel-modes)
152 (if erc-channel-user-limit
153 (format "l %d" erc-channel-user-limit)
154 "")
155 ")")
156 (if (not (eq major-mode 'erc-mode))
157 mode-name
158 "")))
159
160(ibuffer-define-column erc-nick (:name "Nick")
161 (if (eq major-mode 'erc-mode)
162 (erc-current-nick)
163 ""))
164
165(defvar erc-ibuffer-formats '((mark erc-modified erc-away erc-op erc-voice " " (erc-nick 8 8) " " (erc-target 18 40) (erc-members 5 5 :center) (erc-channel-modes 6 16 :center) " " (erc-server-name 20 30) " " (erc-topic 10 -1))
166 (mark erc-modified erc-away erc-op erc-voice " " (erc-target 18 40) (erc-members 5 5 :center) (erc-channel-modes 9 20 :center) " " (erc-topic 10 -1))))
167(setq ibuffer-formats (append ibuffer-formats erc-ibuffer-formats))
168
169(defvar erc-ibuffer-limit-map nil
170 "Prefix keymap to use for ERC related limiting.")
171(define-prefix-command 'erc-ibuffer-limit-map)
172(define-key 'erc-ibuffer-limit-map (kbd "s") 'ibuffer-limit-by-erc-server)
173(define-key ibuffer-mode-map (kbd "/ \C-e") 'erc-ibuffer-limit-map)
174
175(provide 'erc-ibuffer)
176
177;;; erc-ibuffer.el ends here
178;;
179;; Local Variables:
180;; indent-tabs-mode: t
181;; tab-width: 8
182;; End:
183
184;; arch-tag: fbad56a5-8595-45e0-a8c8-d8bb91e26944
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
new file mode 100644
index 00000000000..5cb179c7e22
--- /dev/null
+++ b/lisp/erc/erc-identd.el
@@ -0,0 +1,87 @@
1;;; erc-identd.el --- RFC1413 (identd authentication protocol) server
2
3;; Copyright (C) 2003 Free Software Foundation, Inc.
4
5;; Author: John Wiegley <johnw@gnu.org>
6;; Keywords: comm, processes
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; You can have a local identd server (running on port 8113; I use DNAT
28;; to bind 113->8113) if you add this to .emacs.el:
29
30;; (add-hook 'erc-connect-pre-hook 'erc-identd-start)
31;; (add-hook 'erc-disconnected-hook 'erc-identd-stop)
32
33;;; Code:
34
35(defvar erc-identd-process nil)
36
37(defun erc-identd-filter (proc string)
38 "This filter implements RFC1413 (identd authentication protocol)."
39 (let ((erc-identd-process proc))
40 (when (string-match "\\([0-9]+\\)\\s-*,\\s-*\\([0-9]+\\)" string)
41 (let ((port-on-server (match-string 1 string))
42 (port-on-client (match-string 2 string)))
43 (send-string erc-identd-process
44 (format "%s, %s : USERID : %s : %s\n"
45 port-on-server port-on-client
46 system-type (user-login-name)))
47 (process-send-eof erc-identd-process)))))
48
49(defun erc-identd-start (&optional port)
50 "Start an identd server listening to port 8113.
51Port 113 (auth) will need to be redirected to port 8113 on your
52machine -- using iptables, or a program like redir which can be
53run from inetd. The idea is to provide a simple identd server
54when you need one, without having to install one globally on your
55system."
56 (interactive (list (read-string "Serve identd requests on port: " "8113")))
57 (if (null port)
58 (setq port 8113)
59 (if (stringp port)
60 (setq port (string-to-number port))))
61 (if erc-identd-process
62 (delete-process erc-identd-process))
63 (if (fboundp 'make-network-process)
64 (setq erc-identd-process
65 (make-network-process :name "identd"
66 :buffer (generate-new-buffer "identd")
67 :service port :server t :noquery t
68 :filter 'erc-identd-filter))
69 (open-network-stream-server "identd" (generate-new-buffer "identd")
70 port nil 'erc-identd-filter)))
71
72(defun erc-identd-stop (&rest ignore)
73 (interactive)
74 (when erc-identd-process
75 (delete-process erc-identd-process)
76 (setq erc-identd-process nil)))
77
78(provide 'erc-identd)
79
80;;; erc-identd.el ends here
81;;
82;; Local Variables:
83;; indent-tabs-mode: t
84;; tab-width: 8
85;; End:
86
87;; arch-tag: e0b5f926-0f35-40b9-8ddb-ca06b62a7544
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
new file mode 100644
index 00000000000..c64c9c04723
--- /dev/null
+++ b/lisp/erc/erc-imenu.el
@@ -0,0 +1,143 @@
1;;; erc-imenu.el -- Imenu support for ERC
2
3;; Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcImenu
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file contains code related to Ibuffer and ERC. Totally alpha,
29;; needs work. Usage: Type / C-e C-h when in Ibuffer-mode to see new
30;; limiting commands
31
32;;; Code:
33
34
35;; Author: Mario Lang <mlang@delysid.org>
36
37;; This file is not part of GNU Emacs. But the same license applies.
38
39;;; Commentary:
40
41;; This package defines the function `erc-create-imenu-index'. ERC
42;; uses this for `imenu-create-index-function', and autoloads it.
43;; Therefore, nothing needs to be done to use this package.
44
45;;; Code:
46
47(require 'erc)
48(require 'imenu)
49
50(defun erc-unfill-notice ()
51 "Return text from point to a computed end as a string unfilled.
52Don't rely on this function, read it first!"
53 (let ((str (buffer-substring
54 (save-excursion
55 (re-search-forward (regexp-quote erc-notice-prefix)))
56 (progn
57 (while (save-excursion
58 (forward-line 1)
59 (looking-at " "))
60 (forward-line 1))
61 (end-of-line) (point)))))
62 (with-temp-buffer
63 (insert str)
64 (goto-char (point-min))
65 (while (re-search-forward "\n +" nil t)
66 (replace-match " "))
67 (buffer-substring (point-min) (point-max)))))
68
69;;;###autoload
70(defun erc-create-imenu-index ()
71 (let ((index-alist '())
72 (notice-alist '())
73 (join-alist '())
74 (left-alist '())
75 (quit-alist '())
76 (message-alist '())
77 (mode-change-alist '())
78 (topic-change-alist '())
79 prev-pos)
80 (goto-char (point-max))
81 (imenu-progress-message prev-pos 0)
82 (while (if (bolp)
83 (> (forward-line -1)
84 -1)
85 (progn (forward-line 0)
86 t))
87 (imenu-progress-message prev-pos nil t)
88 (save-match-data
89 (when (looking-at (concat (regexp-quote erc-notice-prefix)
90 "\\(.+\\)$"))
91 (let ((notice-text ;; Ugly hack, but seems to work.
92 (save-excursion (erc-unfill-notice)))
93 (pos (point)))
94 (push (cons notice-text pos) notice-alist)
95 (or
96 (when (string-match "^\\(.*\\) has joined channel" notice-text)
97 (push (cons (match-string 1 notice-text) pos) join-alist))
98 (when (string-match "^\\(.+\\) has left channel" notice-text)
99 (push (cons (match-string 1 notice-text) pos) left-alist))
100 (when (string-match "^\\(.+\\) has quit\\(.*\\)$" notice-text)
101 (push (cons (concat (match-string 1 notice-text)
102 (match-string 2 notice-text))
103 (point))
104 quit-alist))
105 (when (string-match
106 "^\\(\\S-+\\) (.+) has changed mode for \\S-+ to \\(.*\\)$"
107 notice-text)
108 (push (cons (concat (match-string 1 notice-text) ": "
109 (match-string 2 notice-text))
110 (point))
111 mode-change-alist))
112 (when (string-match
113 "^\\(\\S-+\\) (.+) has set the topic for \\S-+: \\(.*\\)$"
114 notice-text)
115 (push (cons (concat (match-string 1 notice-text) ": "
116 (match-string 2 notice-text)) pos)
117 topic-change-alist)))))
118 (when (looking-at "<\\(\\S-+\\)> \\(.+\\)$")
119 (let ((from (match-string 1))
120 (message-text (match-string 2)))
121 (push (cons (concat from ": " message-text) (point))
122 message-alist)))))
123 (and notice-alist (push (cons "notices" notice-alist) index-alist))
124 (and join-alist (push (cons "joined" join-alist) index-alist))
125 (and left-alist (push (cons "parted" left-alist) index-alist))
126 (and quit-alist (push (cons "quit" quit-alist) index-alist))
127 (and mode-change-alist (push (cons "mode-change" mode-change-alist)
128 index-alist))
129 (and message-alist (push (cons "messages" message-alist) index-alist))
130 (and topic-change-alist (push (cons "topic-change" topic-change-alist)
131 index-alist))
132 index-alist))
133
134(provide 'erc-imenu)
135
136;;; erc-imenu.el ends here
137;;
138;; Local Variables:
139;; indent-tabs-mode: t
140;; tab-width: 8
141;; End:
142
143;; arch-tag: 35c69082-ca29-43f7-a050-8da5f400de81
diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el
new file mode 100644
index 00000000000..20c89a8b0b6
--- /dev/null
+++ b/lisp/erc/erc-lang.el
@@ -0,0 +1,213 @@
1;;; erc-lang.el --- provide the LANG command to ERC
2
3;; Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; Maintainer: Alex Schroeder <alex@gnu.org>
7;; Version: 1.0.0
8;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcLang
9;; Keywords: comm languages processes
10
11;; This file is part of GNU Emacs.
12
13;; GNU Emacs is free software; you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation; either version 2, or (at your option)
16;; any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs; see the file COPYING. If not, write to the
25;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26;; Boston, MA 02110-1301, USA.
27
28;;; Commentary:
29
30;; This provides two commands: `language' is for everyday use, and
31;; `erc-cmd-LANG' provides the /LANG command to ERC.
32
33;;; Code:
34
35(require 'erc)
36
37(defvar iso-638-languages
38 '(("aa" . "Afar")
39 ("ab" . "Abkhazian")
40 ("af" . "Afrikaans")
41 ("am" . "Amharic")
42 ("ar" . "Arabic")
43 ("as" . "Assamese")
44 ("ay" . "Aymara")
45 ("az" . "Azerbaijani")
46 ("ba" . "Bashkir")
47 ("be" . "Byelorussian")
48 ("bg" . "Bulgarian")
49 ("bh" . "Bihari")
50 ("bi" . "Bislama")
51 ("bn" . "Bengali; Bangla")
52 ("bo" . "Tibetan")
53 ("br" . "Breton")
54 ("ca" . "Catalan")
55 ("co" . "Corsican")
56 ("cs" . "Czech")
57 ("cy" . "Welsh")
58 ("da" . "Danish")
59 ("de" . "German")
60 ("dz" . "Bhutani")
61 ("el" . "Greek")
62 ("en" . "English")
63 ("eo" . "Esperanto")
64 ("es" . "Spanish")
65 ("et" . "Estonian")
66 ("eu" . "Basque")
67 ("fa" . "Persian")
68 ("fi" . "Finnish")
69 ("fj" . "Fiji")
70 ("fo" . "Faroese")
71 ("fr" . "French")
72 ("fy" . "Frisian")
73 ("ga" . "Irish")
74 ("gd" . "Scots Gaelic")
75 ("gl" . "Galician")
76 ("gn" . "Guarani")
77 ("gu" . "Gujarati")
78 ("ha" . "Hausa")
79 ("he" . "Hebrew (formerly iw)")
80 ("hi" . "Hindi")
81 ("hr" . "Croatian")
82 ("hu" . "Hungarian")
83 ("hy" . "Armenian")
84 ("ia" . "Interlingua")
85 ("id" . "Indonesian (formerly in)")
86 ("ie" . "Interlingue")
87 ("ik" . "Inupiak")
88 ("is" . "Icelandic")
89 ("it" . "Italian")
90 ("iu" . "Inuktitut")
91 ("ja" . "Japanese")
92 ("jw" . "Javanese")
93 ("ka" . "Georgian")
94 ("kk" . "Kazakh")
95 ("kl" . "Greenlandic")
96 ("km" . "Cambodian")
97 ("kn" . "Kannada")
98 ("ko" . "Korean")
99 ("ks" . "Kashmiri")
100 ("ku" . "Kurdish")
101 ("ky" . "Kirghiz")
102 ("la" . "Latin")
103 ("ln" . "Lingala")
104 ("lo" . "Laothian")
105 ("lt" . "Lithuanian")
106 ("lv" . "Latvian, Lettish")
107 ("mg" . "Malagasy")
108 ("mi" . "Maori")
109 ("mk" . "Macedonian")
110 ("ml" . "Malayalam")
111 ("mn" . "Mongolian")
112 ("mo" . "Moldavian")
113 ("mr" . "Marathi")
114 ("ms" . "Malay")
115 ("mt" . "Maltese")
116 ("my" . "Burmese")
117 ("na" . "Nauru")
118 ("ne" . "Nepali")
119 ("nl" . "Dutch")
120 ("no" . "Norwegian")
121 ("oc" . "Occitan")
122 ("om" . "(Afan) Oromo")
123 ("or" . "Oriya")
124 ("pa" . "Punjabi")
125 ("pl" . "Polish")
126 ("ps" . "Pashto, Pushto")
127 ("pt" . "Portuguese")
128 ("qu" . "Quechua")
129 ("rm" . "Rhaeto-Romance")
130 ("rn" . "Kirundi")
131 ("ro" . "Romanian")
132 ("ru" . "Russian")
133 ("rw" . "Kinyarwanda")
134 ("sa" . "Sanskrit")
135 ("sd" . "Sindhi")
136 ("sg" . "Sangho")
137 ("sh" . "Serbo-Croatian")
138 ("si" . "Sinhalese")
139 ("sk" . "Slovak")
140 ("sl" . "Slovenian")
141 ("sm" . "Samoan")
142 ("sn" . "Shona")
143 ("so" . "Somali")
144 ("sq" . "Albanian")
145 ("sr" . "Serbian")
146 ("ss" . "Siswati")
147 ("st" . "Sesotho")
148 ("su" . "Sundanese")
149 ("sv" . "Swedish")
150 ("sw" . "Swahili")
151 ("ta" . "Tamil")
152 ("te" . "Telugu")
153 ("tg" . "Tajik")
154 ("th" . "Thai")
155 ("ti" . "Tigrinya")
156 ("tk" . "Turkmen")
157 ("tl" . "Tagalog")
158 ("tn" . "Setswana")
159 ("to" . "Tonga")
160 ("tr" . "Turkish")
161 ("ts" . "Tsonga")
162 ("tt" . "Tatar")
163 ("tw" . "Twi")
164 ("ug" . "Uighur")
165 ("uk" . "Ukrainian")
166 ("ur" . "Urdu")
167 ("uz" . "Uzbek")
168 ("vi" . "Vietnamese")
169 ("vo" . "Volapuk")
170 ("wo" . "Wolof")
171 ("xh" . "Xhosa")
172 ("yi" . "Yiddish (formerly ji)")
173 ("yo" . "Yoruba")
174 ("za" . "Zhuang")
175 ("zh" . "Chinese")
176 ("zu" . "Zulu"))
177 "Alist of ISO language codes and language names.
178This is based on the technical contents of ISO 639:1988 (E/F)
179\"Code for the representation of names of languages\".
180
181Typed by Keld.Simonsen@dkuug.dk 1990-11-30
182 <ftp://dkuug.dk/i18n/ISO_639>
183Minor corrections, 1992-09-08 by Keld Simonsen
184Sundanese corrected, 1992-11-11 by Keld Simonsen
185Telugu corrected, 1995-08-24 by Keld Simonsen
186Hebrew, Indonesian, Yiddish corrected 1995-10-10 by Michael Everson
187Inuktitut, Uighur, Zhuang added 1995-10-10 by Michael Everson
188Sinhalese corrected, 1995-10-10 by Michael Everson
189Faeroese corrected to Faroese, 1995-11-18 by Keld Simonsen
190Sangro corrected to Sangho, 1996-07-28 by Keld Simonsen
191
192Two-letter lower-case symbols are used.
193The Registration Authority for ISO 639 is Infoterm, Osterreichisches
194Normungsinstitut (ON), Postfach 130, A-1021 Vienna, Austria.")
195
196(defun language (code)
197 "Return the language name for the ISO CODE."
198 (interactive (list (completing-read "ISO language code: "
199 iso-638-languages)))
200 (message (cdr (assoc code iso-638-languages))))
201
202(defun erc-cmd-LANG (language)
203 "Display the language name for the language code given by LANGUAGE."
204 (let ((lang (cdr (assoc language iso-638-languages))))
205 (erc-display-message
206 nil 'notice 'active
207 (or lang (concat line ": No such domain"))))
208 t)
209
210(provide 'erc-lang)
211
212;; arch-tag: 8ffb1563-cc03-4517-b067-16309d4ff97b
213;;; erc-lang.el ends here
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
new file mode 100644
index 00000000000..785e4d19750
--- /dev/null
+++ b/lisp/erc/erc-list.el
@@ -0,0 +1,396 @@
1;;; erc-list.el --- Provide a faster channel listing mechanism
2
3;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4;; Copyright (C) 2004 Brian Palmer
5
6;; Author: Mario Lang <mlang@lexx.delysid.org>
7;; Keywords: comm
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file provides a simple derived mode for viewing Channel lists.
29;; It also serves as a demonstration of how the new server hook facility
30;; can be used.
31
32;;; Code:
33
34(require 'erc)
35(require 'erc-nets)
36(require 'sort)
37(unless (fboundp 'make-overlay)
38 (require 'overlay))
39(eval-when-compile (require 'cl))
40
41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42;; User customizable variables.
43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
44
45(defgroup erc-list nil
46 "Display IRC channels in another window when using /LIST"
47 :group 'erc)
48
49(defcustom erc-chanlist-progress-message t
50 "*Show progress message while accumulating channel list."
51 :group 'erc-list
52 :type 'boolean)
53
54(defcustom erc-no-list-networks nil
55 "*A list of network names on which the /LIST command refuses to work."
56 :group 'erc-list
57 :type '(repeat string))
58
59(defcustom erc-chanlist-frame-parameters nil
60 "*If nil, the channel list is displayed in a new window; if non-nil,
61this variable holds the frame parameters used to make a frame to
62display the channel list."
63 :group 'erc-list
64 :type 'list)
65
66(defcustom erc-chanlist-hide-modeline nil
67 "*If nil, the channel list buffer has a modeline, otherwise the modeline is hidden."
68 :group 'erc-list
69 :type 'boolean)
70
71(defface erc-chanlist-header-face '((t (:bold t)))
72 "Face used for the headers in erc's channel list."
73 :group 'erc-faces)
74
75(defface erc-chanlist-odd-line-face '((t (:inverse-video t)))
76 "Face used for the odd lines in erc's channel list."
77 :group 'erc-faces)
78
79(defface erc-chanlist-even-line-face '((t (:inverse-video nil)))
80 "Face used for the even lines in erc's channel list."
81 :group 'erc-faces)
82
83(defface erc-chanlist-highlight '((t (:foreground "red")))
84 "Face used to highlight the current line in the channel list."
85 :group 'erc-faces)
86
87;; This should perhaps be a defface that inherits values from the highlight face
88;; but xemacs does not support inheritance
89(defcustom erc-chanlist-highlight-face 'erc-chanlist-highlight
90 "Face used for highlighting the current line in a list."
91 :type 'face
92 :group 'erc-faces)
93
94
95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96;; All variables below this line are for internal use only.
97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
98
99(defvar erc-chanlist-channel-line-regexp "^\\([#&\\*][^ \t\n]*\\)\\s-+[0-9]+"
100 "Regexp that matches a channel line in the channel list buffer.")
101
102(defvar erc-chanlist-buffer nil)
103(make-variable-buffer-local 'erc-chanlist-buffer)
104
105(defvar erc-chanlist-last-time 0
106 "A time value used to throttle the progress indicator.")
107
108(defvar erc-chanlist-frame nil
109 "The frame displaying the most recent channel list buffer.")
110
111(defvar erc-chanlist-sort-state 'channel
112 "The sort mode of the channel list buffer. Either 'channel or 'users.")
113(make-variable-buffer-local 'erc-chanlist-sort-state)
114
115(defvar erc-chanlist-highlight-overlay nil
116 "The overlay used for erc chanlist highlighting")
117(make-variable-buffer-local 'erc-chanlist-highlight-overlay)
118
119;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
120;; Define erc-chanlist-mode.
121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
122
123(defcustom erc-chanlist-mode-hook nil
124 "Hook run by erc-chanlist-mode."
125 :group 'erc-list
126 :type 'hook)
127
128(define-derived-mode erc-chanlist-mode fundamental-mode "ERC Channel List"
129 "Mode for viewing a channel list of a particular server.
130
131\\{erc-chanlist-mode-map}"
132 (local-set-key "\C-c\C-j" 'erc-join-channel)
133 (local-set-key "j" 'erc-chanlist-join-channel)
134 (local-set-key "n" 'next-line)
135 (local-set-key "p" 'previous-line)
136 (local-set-key "q" 'erc-chanlist-quit)
137 (local-set-key "s" 'erc-chanlist-toggle-sort-state)
138 (local-set-key "t" 'toggle-truncate-lines)
139 (setq erc-chanlist-sort-state 'channel)
140 (setq truncate-lines t)
141 (add-hook 'post-command-hook 'erc-chanlist-post-command-hook 'append 'local))
142
143;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
144;; Functions.
145;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146
147;;;###autoload
148(defun erc-cmd-LIST (&rest channel)
149 "Display a buffer containing a list of channels on the current server.
150Optional argument CHANNEL specifies a single channel to list (instead of every
151available channel)."
152 (interactive
153 (remove "" (split-string
154 (read-from-minibuffer "List channels (RET for all): ") " ")))
155 (if (and (null channel)
156 (erc-member-ignore-case (erc-network-name) erc-no-list-networks))
157 (erc-display-line "ERC is configured not to allow the /LIST command on this network!"
158 (current-buffer))
159 (erc-display-line (erc-make-notice (concat "Listing channel"
160 (if channel
161 "."
162 "s. This may take a while."))))
163 (erc-chanlist channel))
164 t)
165
166;;;###autoload
167(defun erc-chanlist (&optional channels)
168 "Show a channel listing of the current server in a special mode.
169Please note that this function only works with IRC servers which conform
170to RFC and send the LIST header (#321) at start of list transmission."
171 (interactive)
172 (with-current-buffer (erc-server-buffer)
173 (erc-once-with-server-event
174 321
175 '(progn
176 (add-hook 'erc-server-322-functions 'erc-chanlist-322 nil t)
177
178 (erc-once-with-server-event
179 323
180 '(progn
181 (remove-hook 'erc-server-322-functions 'erc-chanlist-322 t)
182 (let ((buf erc-chanlist-buffer))
183 (if (not (buffer-live-p buf))
184 (error "`erc-chanlist-buffer' does not refer to a live buffer"))
185
186 (set-buffer buf)
187 (buffer-disable-undo)
188 (let (buffer-read-only
189 (sort-fold-case t))
190 (sort-lines nil (point-min) (point-max))
191 (setq erc-chanlist-sort-state 'channel)
192
193 (let ((sum (count-lines (point-min) (point-max))))
194 (goto-char (point-min))
195 (insert (substitute-command-keys
196 (concat "'\\[erc-chanlist-toggle-sort-state]' toggle sort mode.\n"
197 "'\\[erc-chanlist-quit]' kill this buffer.\n"
198 "'\\[toggle-truncate-lines]' toggle line truncation.\n"
199 "'\\[erc-chanlist-join-channel]' join the channel listed on the current line.\n\n")))
200 (insert (format "%d channels (sorted by %s).\n\n"
201 sum (if (eq erc-chanlist-sort-state 'channel)
202 "channel name"
203 "number of users"))))
204
205 (insert (format "%-25s%5s %s\n------------------------ ----- ----------------------------\n"
206 "Channel"
207 "Users"
208 "Topic"))
209
210 ;; Display the channel list buffer.
211 (if erc-chanlist-frame-parameters
212 (progn
213 (if (or (null erc-chanlist-frame)
214 (not (frame-live-p erc-chanlist-frame)))
215 (setq erc-chanlist-frame
216 (make-frame `((name . ,(format "Channels on %s"
217 erc-session-server))
218 ,@erc-chanlist-frame-parameters))))
219 (select-frame erc-chanlist-frame)
220 (switch-to-buffer buf)
221 (erc-prettify-channel-list))
222 (pop-to-buffer buf)
223 (erc-prettify-channel-list))))
224 (goto-char (point-min))
225 (search-forward-regexp "^------" nil t)
226 (forward-line 1)
227 (erc-chanlist-highlight-line)
228 (message "")
229 t))
230
231 (setq erc-chanlist-buffer (get-buffer-create
232 (format "*Channels on %s*"
233 (erc-response.sender parsed))))
234 (with-current-buffer erc-chanlist-buffer
235 (setq buffer-read-only nil)
236 (erase-buffer)
237 (erc-chanlist-mode)
238 (setq erc-server-process proc)
239 (if erc-chanlist-hide-modeline
240 (setq mode-line-format nil))
241 (setq buffer-read-only t))
242 t))
243
244 ;; Now that we've setup our callbacks, pull the trigger.
245 (if (interactive-p)
246 (message "Collecting channel list for server %s" erc-session-server))
247 (erc-server-send (if (null channels)
248 "LIST"
249 (concat "LIST "
250 (mapconcat #'identity channels ","))))))
251
252(defun erc-chanlist-322 (proc parsed)
253 "Process an IRC 322 message.
254
255The message carries information about one channel for the LIST
256command."
257 (multiple-value-bind (channel num-users)
258 (cdr (erc-response.command-args parsed))
259 (let ((topic (erc-response.contents parsed)))
260 (with-current-buffer erc-chanlist-buffer
261 (save-excursion
262 (goto-char (point-max))
263 (let (buffer-read-only)
264 (insert (format "%-26s%4s %s\n" (erc-controls-strip channel)
265 num-users
266 (erc-controls-strip topic))))
267
268 ;; Maybe display a progress indicator in the minibuffer.
269 (when (and erc-chanlist-progress-message
270 (> (erc-time-diff
271 erc-chanlist-last-time (erc-current-time))
272 3))
273 (setq erc-chanlist-last-time (erc-current-time))
274 (message "Accumulating channel list ... %c"
275 (aref [?/ ?| ?\\ ?- ?! ?O ?o] (random 7))))
276
277 ;; Return success to prevent other hook functions from being run.
278 t)))))
279
280(defun erc-chanlist-post-command-hook ()
281 "Keep the current line highlighted."
282 (ignore-errors
283 (save-excursion
284 (beginning-of-line)
285 (if (looking-at erc-chanlist-channel-line-regexp)
286 (erc-chanlist-highlight-line)
287 (erc-chanlist-dehighlight-line)))))
288
289(defun erc-chanlist-highlight-line ()
290 "Highlight the current line."
291 (unless erc-chanlist-highlight-overlay
292 (setq erc-chanlist-highlight-overlay
293 (make-overlay (point-min) (point-min)))
294 ;; Detach it from the buffer.
295 (delete-overlay erc-chanlist-highlight-overlay)
296 (overlay-put erc-chanlist-highlight-overlay
297 'face erc-chanlist-highlight-face)
298 ;; Expressly put it at a higher priority than the text
299 ;; properties used for faces later on. Gnu emacs promises that
300 ;; right now overlays are higher priority than text properties,
301 ;; but why take chances?
302 (overlay-put erc-chanlist-highlight-overlay 'priority 1))
303 (move-overlay erc-chanlist-highlight-overlay (point) (1+ (point-at-eol))))
304
305(defun erc-chanlist-dehighlight-line ()
306 "Remove the line highlighting."
307 (delete-overlay erc-chanlist-highlight-overlay))
308
309(defun erc-prettify-channel-list ()
310 "Make the channel list buffer look pretty.
311When this function runs, the current buffer must be the channel
312list buffer, or it does nothing."
313 (if (eq major-mode 'erc-chanlist-mode)
314 (save-excursion
315 (let ((inhibit-read-only t))
316 (goto-char (point-min))
317 (when (search-forward-regexp "^-------" nil t)
318 (add-text-properties
319 (point-min) (1+ (point-at-eol)) '(face erc-chanlist-header-face))
320 (forward-line 1))
321
322 (while (not (eobp))
323 (add-text-properties
324 (point) (1+ (point-at-eol)) '(face erc-chanlist-odd-line-face))
325 (forward-line 1)
326 (unless (eobp)
327 (add-text-properties
328 (point) (1+ (point-at-eol)) '(face erc-chanlist-even-line-face)))
329 (forward-line 1))))))
330
331(defun erc-chanlist-toggle-sort-state ()
332 "Toggle the channel list buffer sorting method.
333Either sort by channel names or by number of users in each channel."
334 (interactive)
335 (let ((inhibit-read-only t)
336 (sort-fold-case t))
337 (save-excursion
338 (goto-char (point-min))
339 (search-forward-regexp "^-----" nil t)
340 (forward-line 1)
341 (unless (eobp)
342 (if (eq erc-chanlist-sort-state 'channel)
343 (progn
344 (sort-numeric-fields 2 (point) (point-max))
345 (reverse-region (point) (point-max))
346 (setq erc-chanlist-sort-state 'users))
347 (sort-lines nil (point) (point-max))
348 (setq erc-chanlist-sort-state 'channel))
349
350 (goto-char (point-min))
351 (if (search-forward-regexp "^[0-9]+ channels (sorted by \\(.*\\)).$"
352 nil t)
353 (replace-match (if (eq erc-chanlist-sort-state 'channel)
354 "channel name"
355 "number of users")
356 nil nil nil 1))
357
358 (goto-char (point-min))
359 (search-forward-regexp "^-----" nil t)
360 (forward-line 1)
361 (recenter -1)
362
363 (erc-prettify-channel-list)))))
364
365(defun erc-chanlist-quit ()
366 "Quit Chanlist mode.
367Kill the channel list buffer, window, and frame (if there's a frame
368devoted to the channel list)."
369 (interactive)
370 (kill-buffer (current-buffer))
371 (if (eq (selected-frame) erc-chanlist-frame)
372 (delete-frame)
373 (delete-window)))
374
375(defun erc-chanlist-join-channel ()
376 "Join the channel listed on the current line of the channel list buffer.
377Private channels, which are shown as asterisks (*), are ignored."
378 (interactive)
379 (save-excursion
380 (beginning-of-line)
381 (when (looking-at erc-chanlist-channel-line-regexp)
382 (let ((channel-name (match-string 1)))
383 (when (and (stringp channel-name)
384 (not (string= channel-name "*")))
385 (run-at-time 0.5 nil 'erc-join-channel channel-name))))))
386
387(provide 'erc-list)
388
389;;; erc-list.el ends here
390;;
391;; Local Variables:
392;; indent-tabs-mode: t
393;; tab-width: 8
394;; End:
395
396;; arch-tag: 4a13196a-a61b-465a-9926-044dfbc7e5ff
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
new file mode 100644
index 00000000000..d4e6e5ad3fa
--- /dev/null
+++ b/lisp/erc/erc-log.el
@@ -0,0 +1,358 @@
1;;; erc-log.el --- Logging facilities for ERC.
2
3;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
4
5;; Author: Lawrence Mitchell <wence@gmx.li>
6;; Keywords: IRC, chat, client, Internet, logging
7
8;; Created 2003-04-26
9;; Logging code taken from erc.el and modified to use markers.
10
11;; This file is part of GNU Emacs.
12
13;; GNU Emacs is free software; you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation; either version 2, or (at your option)
16;; any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs; see the file COPYING. If not, write to the
25;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26;; Boston, MA 02110-1301, USA.
27
28;;; Commentary:
29
30;; This file implements log file writing support for ERC.
31
32;; Quick start:
33;;
34;; (setq erc-enable-logging t)
35;; (setq erc-log-channels-directory "/path/to/logfiles") ; must be writable
36;;
37;; There are two ways to setup logging. The first will write to the log files
38;; on each incoming or outgoing line - this may not be optimal on a laptop
39;; HDD. To do this, M-x customize-variable erc-modules, and add "log".
40;;
41;; The second method will save buffers on /part, /quit, or killing the
42;; channel buffer. To do this, add the following to your .emacs:
43;;
44;; (require 'erc-log)
45;;
46;; You may optionally want the following code, to save all ERC buffers
47;; without confirmation when exiting emacs:
48;;
49;; (defadvice save-buffers-kill-emacs (before save-logs (&rest args) activate)
50;; (save-some-buffers t (lambda ()
51;; (when (and (eq major-mode 'erc-mode)
52;; (not (null buffer-file-name))) t))))
53;;
54;; If you only want to save logs for some buffers, customise the
55;; variable `erc-enable-logging'.
56
57;; How it works:
58;;
59;; If logging is enabled, at some point, `erc-save-buffer-in-logs'
60;; will be called. The "end" of the buffer is taken from
61;; `erc-insert-marker', while `erc-last-saved-position' holds the
62;; position the buffer was last saved at (as a marker, or if the
63;; buffer hasn't been saved before, as the number 1 (point-min)).
64
65;; The region between `erc-last-saved-position' and
66;; `erc-insert-marker' is saved to the current buffer's logfile, and
67;; `erc-last-saved-position' is updated to reflect this.
68
69;;; History:
70;; 2003-04-26: logging code pulled out of erc.el. Switched to using
71;; markers.
72
73;;; TODO:
74;; * Erc needs a generalised make-safe-file-name function, so that
75;; generated file names don't contain any invalid file characters.
76;;
77;; * Really, we need to lock the logfiles somehow, so that if a user
78;; is running multiple emacsen and/or on the same channel as more
79;; than one user, only one process writes to the logfile. This is
80;; especially needed for those logfiles with no nick in them, as
81;; these would become corrupted.
82;; For a single emacs process, the problem could be solved using a
83;; variable which contained the names of buffers already being
84;; logged. This would require that logging be buffer-local,
85;; possibly not a bad thing anyway, since many people don't want to
86;; log the server buffer.
87;; For multiple emacsen the problem is trickier. On some systems,
88;; on could use the function `lock-buffer' and `unlock-buffer'.
89;; However, file locking isn't implemented on all platforms, for
90;; example, there is none on w32 systems.
91;; A third possibility might be to fake lockfiles. However, this
92;; might lead to problems if an emacs crashes, as the lockfile
93;; would be left lying around.
94
95;;; Code:
96
97(require 'erc)
98(eval-when-compile (require 'cl))
99
100(defgroup erc-log nil
101 "Logging facilities for ERC."
102 :group 'erc)
103
104(defcustom erc-generate-log-file-name-function 'erc-generate-log-file-name-long
105 "*A function to generate a log filename.
106The function must take five arguments: BUFFER, TARGET, NICK, SERVER and PORT.
107BUFFER is the buffer to be saved,
108TARGET is the name of the channel, or the target of the query,
109NICK is the current nick,
110SERVER and PORT are the parameters used to connect BUFFERs
111`erc-server-process'."
112 :group 'erc-log
113 :type '(choice (const erc-generate-log-file-name-long)
114 (const erc-generate-log-file-name-short)
115 (const erc-generate-log-file-name-with-date)
116 (symbol)))
117
118(defcustom erc-save-buffer-on-part nil
119 "*Save the channel buffer content using `erc-save-buffer-in-logs' on PART."
120 :group 'erc-log
121 :type 'boolean)
122
123(defcustom erc-truncate-buffer-on-save nil
124 "Truncate any ERC (channel, query, server) buffer when it is saved."
125 :group 'erc-log
126 :type 'boolean)
127
128(defcustom erc-enable-logging t
129 "If non-nil, ERC will log IRC conversations.
130This can either be a boolean value of nil or t, or a function.
131If the value is a function, it will be called with one argument, the
132name of the current ERC buffer. One possible function, which saves
133all but server buffers is `erc-log-all-but-server-buffers'.
134
135This variable is buffer local. Setting it via \\[customize] sets the
136default value.
137
138Log files are stored in `erc-log-channels-directory'."
139 :group 'erc-log
140 :type '(choice boolean
141 function))
142(make-variable-buffer-local 'erc-enable-logging)
143
144(defcustom erc-log-channels-directory "~/log"
145 "The directory to place log files for channels.
146Leave blank to disable logging. If not nil, all the channel
147buffers are logged in separate files in that directory. The
148directory should not end with a trailing slash."
149 :group 'erc-log
150 :type '(choice directory
151 (const nil)))
152
153(defcustom erc-log-insert-log-on-open t
154 "*Insert log file contents into the buffer if a log file exists."
155 :group 'erc-log
156 :type 'boolean)
157
158(defcustom erc-save-queries-on-quit nil
159 "Save all query (also channel) buffers of the server on QUIT.
160See the variable `erc-save-buffer-on-part' for details."
161 :group 'erc-log
162 :type 'boolean)
163
164(defcustom erc-log-file-coding-system (if (featurep 'xemacs)
165 'binary
166 'emacs-mule)
167 "*The coding system ERC should use for writing log files.
168
169This should ideally, be a \"catch-all\" coding system, like
170`emacs-mule', or `iso-2022-7bit'."
171 :group 'erc-log)
172
173;;;###autoload (autoload 'erc-log-mode "erc-log" nil t)
174(define-erc-module log nil
175 "Automatically logs things you receive on IRC into files.
176Files are stored in `erc-log-channels-directory'; file name
177format is defined through a formatting function on
178`erc-generate-log-file-name-function'.
179
180Since automatic logging is not always a Good Thing (especially if
181people say things in different coding systems), you can turn logging
182behaviour on and off with the variable `erc-enable-logging', which can
183also be a predicate function. To only log when you are not set away, use:
184
185\(setq erc-enable-logging
186 (lambda (buffer)
187 (with-current-buffer buffer
188 (not erc-away))))"
189 ;; enable
190 ((add-hook 'erc-insert-post-hook
191 'erc-save-buffer-in-logs)
192 (add-hook 'erc-send-post-hook
193 'erc-save-buffer-in-logs))
194 ;; disable
195 ((remove-hook 'erc-insert-post-hook
196 'erc-save-buffer-in-logs)
197 (remove-hook 'erc-send-post-hook
198 'erc-save-buffer-in-logs)))
199
200(when erc-enable-logging
201 (add-hook 'erc-kill-buffer-hook
202 'erc-save-buffer-in-logs)
203 (add-hook 'erc-kill-channel-hook
204 'erc-save-buffer-in-logs)
205 (add-hook 'erc-quit-hook
206 'erc-conditional-save-queries)
207 (add-hook 'erc-part-hook
208 'erc-conditional-save-buffer))
209
210(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
211
212;;;functionality referenced from erc.el
213(defun erc-log-setup-logging ()
214 "Setup the buffer-local logging variables in the current buffer.
215This function is destined to be run from `erc-connect-pre-hook'."
216 (when (erc-logging-enabled)
217 (auto-save-mode -1)
218 (setq buffer-offer-save t
219 buffer-file-name "")
220 (set (make-local-variable 'write-file-functions)
221 '(erc-save-buffer-in-logs))
222 (when erc-log-insert-log-on-open
223 (ignore-errors (insert-file-contents (erc-current-logfile))
224 (move-marker erc-last-saved-position
225 (1- (point-max)))))))
226
227;;; Append, so that 'erc-initialize-log-marker keeps running first.
228(add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
229
230(defun erc-log-all-but-server-buffers (buffer)
231 "Returns t if logging should be enabled in BUFFER.
232Returns nil iff `erc-server-buffer-p' returns t."
233 (save-excursion
234 (save-window-excursion
235 (set-buffer buffer)
236 (not (erc-server-buffer-p)))))
237
238(defun erc-save-query-buffers (process)
239 "Save all buffers process."
240 (erc-with-all-buffers-of-server process
241 nil
242 (erc-save-buffer-in-logs)))
243
244(defun erc-conditional-save-buffer (buffer)
245 "Save Query BUFFER if `erc-save-queries-on-quit' is t."
246 (when erc-save-buffer-on-part
247 (erc-save-buffer-in-logs buffer)))
248
249(defun erc-conditional-save-queries (process)
250 "Save Query buffers of PROCESS if `erc-save-queries-on-quit' is t."
251 (when erc-save-queries-on-quit
252 (erc-save-query-buffers process)))
253
254;;;###autoload
255(defun erc-logging-enabled (&optional buffer)
256 "Return non-nil if logging is enabled for BUFFER.
257If BUFFER is nil, the value of `current-buffer' is used.
258Logging is enabled if `erc-log-channels-directory' is non-nil, the directory
259is writeable (it will be created as necessary) and
260`erc-enable-logging' returns a non-nil value."
261 (and erc-log-channels-directory
262 (erc-directory-writable-p erc-log-channels-directory)
263 (if (functionp erc-enable-logging)
264 (funcall erc-enable-logging (or buffer (current-buffer)))
265 erc-enable-logging)))
266
267(defun erc-current-logfile (&optional buffer)
268 "Return the logfile to use for BUFFER.
269If BUFFER is nil, the value of `current-buffer' is used.
270This is determined by `erc-generate-log-file-name-function'.
271The result is converted to lowercase, as IRC is case-insensitive"
272 (expand-file-name
273 (downcase (funcall erc-generate-log-file-name-function
274 (or buffer (current-buffer))
275 (or (erc-default-target) (buffer-name buffer))
276 (erc-current-nick)
277 erc-session-server erc-session-port))
278 erc-log-channels-directory))
279
280(defun erc-generate-log-file-name-with-date (buffer &rest ignore)
281 "This function computes a short log file name.
282The name of the log file is composed of BUFFER and the current date.
283This function is a possible value for `erc-generate-log-file-name-function'."
284 (concat (buffer-name buffer) "-" (format-time-string "%Y-%m-%d") ".txt"))
285
286(defun erc-generate-log-file-name-short (buffer &rest ignore)
287 "This function computes a short log file name.
288In fact, it only uses the buffer name of the BUFFER argument, so
289you can affect that using `rename-buffer' and the-like. This
290function is a possible value for
291`erc-generate-log-file-name-function'."
292 (concat (buffer-name buffer) ".txt"))
293
294(defun erc-generate-log-file-name-long (buffer target nick server port)
295 "Generates a log-file name in the way ERC always did it.
296This results in a file name of the form #channel!nick@server:port.txt.
297This function is a possible value for `erc-generate-log-file-name-function'."
298 (let ((file (concat
299 (if target (concat target "!"))
300 nick "@" server ":" (cond ((stringp port) port)
301 ((numberp port)
302 (number-to-string port))) ".txt")))
303 ;; we need a make-safe-file-name function.
304 (convert-standard-filename file)))
305
306;;;###autoload
307(defun erc-save-buffer-in-logs (&optional buffer)
308 "Append BUFFER contents to the log file, if logging is enabled.
309If BUFFER is not provided, current buffer is used.
310Logging is enabled if `erc-logging-enabled' returns non-nil.
311
312This is normally done on exit, to save the unsaved portion of the
313buffer, since only the text that runs off the buffer limit is logged
314automatically.
315
316You can save every individual message by putting this function on
317`erc-insert-post-hook'."
318 (interactive)
319 (or buffer (setq buffer (current-buffer)))
320 (when (erc-logging-enabled buffer)
321 (let ((file (erc-current-logfile buffer))
322 (coding-system-for-write erc-log-file-coding-system))
323 (save-excursion
324 (with-current-buffer buffer
325 (save-restriction
326 (widen)
327 ;; early on in the initalisation, don't try and write the log out
328 (when (and (markerp erc-last-saved-position)
329 (> erc-insert-marker (1+ erc-last-saved-position)))
330 (write-region (1+ (marker-position erc-last-saved-position))
331 (marker-position erc-insert-marker)
332 file t 'nomessage)
333 (if (and erc-truncate-buffer-on-save (interactive-p))
334 (progn
335 (let ((inhibit-read-only t)) (erase-buffer))
336 (move-marker erc-last-saved-position (point-max))
337 (erc-display-prompt))
338 (move-marker erc-last-saved-position
339 ;; If we place erc-last-saved-position at
340 ;; erc-insert-marker, because text gets
341 ;; inserted /before/ erc-insert-marker,
342 ;; the log file will not be saved
343 ;; (erc-last-saved-position will always
344 ;; be equal to erc-insert-marker).
345 (1- (marker-position erc-insert-marker)))))
346 (set-buffer-modified-p nil))))))
347 t)
348
349(provide 'erc-log)
350
351;;; erc-log.el ends here
352;;
353;; Local Variables:
354;; indent-tabs-mode: t
355;; tab-width: 8
356;; End:
357
358;; arch-tag: 54072f99-9f0a-4846-8908-2ccde92221de
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
new file mode 100644
index 00000000000..a5e3bf88ccf
--- /dev/null
+++ b/lisp/erc/erc-match.el
@@ -0,0 +1,658 @@
1;;; erc-match.el --- Highlight messages matching certain regexps
2
3;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5;; Author: Andreas Fuchs <asf@void.at>
6;; Keywords: comm, faces
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcMatch
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file includes stuff to work with pattern matching in ERC. If
29;; you were used to customizing erc-fools, erc-keywords, erc-pals,
30;; erc-dangerous-hosts and the like, this file contains these
31;; customizable variables.
32
33;; Usage:
34;; Put (erc-match-mode 1) into your ~/.emacs file.
35
36;;; Code:
37
38(require 'erc)
39(eval-when-compile (require 'cl))
40
41;; Customisation:
42
43(defgroup erc-match nil
44 "Keyword and Friend/Foe/... recognition.
45Group containing all things concerning pattern matching in ERC
46messages."
47 :group 'erc)
48
49;;;###autoload (autoload 'erc-match-mode "erc-match")
50(define-erc-module match nil
51 "This mode checks whether messages match certain patterns. If so,
52they are hidden or highlighted. This is controlled via the variables
53`erc-pals', `erc-fools', `erc-keywords', `erc-dangerous-hosts', and
54`erc-current-nick-highlight-type'. For all these highlighting types,
55you can decide whether the entire message or only the sending nick is
56highlighted."
57 ((add-hook 'erc-insert-modify-hook 'erc-match-message 'append))
58 ((remove-hook 'erc-insert-modify-hook 'erc-match-message)))
59
60;; Remaining customizations
61
62(defcustom erc-pals nil
63 "List of pals on IRC."
64 :group 'erc-match
65 :type '(repeat regexp))
66
67(defcustom erc-fools nil
68 "List of fools on IRC."
69 :group 'erc-match
70 :type '(repeat regexp))
71
72(defcustom erc-keywords nil
73 "List of keywords to highlight in all incoming messages.
74Each entry in the list is either a regexp, or a cons cell with the
75regexp in the car and the face to use in the cdr. If no face is
76specified, `erc-keyword-face' is used."
77 :group 'erc-match
78 :type '(repeat (choice regexp
79 (list regexp face))))
80
81(defcustom erc-dangerous-hosts nil
82 "List of regexps for hosts to highlight.
83Useful to mark nicks from dangerous hosts."
84 :group 'erc-match
85 :type '(repeat regexp))
86
87(defcustom erc-current-nick-highlight-type 'keyword
88 "*Determines how to highlight text in which your current nickname appears
89\(does not apply to text sent by you\).
90
91The following values are allowed:
92
93 nil - do not highlight the message at all
94 'keyword - highlight all instances of current nickname in message
95 'nick - highlight the nick of the user who typed your nickname
96 'nick-or-keyword - highlight the nick of the user who typed your nickname,
97 or all instances of the current nickname if there was
98 no sending user
99 'all - highlight the entire message where current nickname occurs
100
101Any other value disables highlighting of current nickname altogether."
102 :group 'erc-match
103 :type '(choice (const nil)
104 (const nick)
105 (const keyword)
106 (const nick-or-keyword)
107 (const all)))
108
109(defcustom erc-pal-highlight-type 'nick
110 "*Determines how to highlight messages by pals.
111See `erc-pals'.
112
113The following values are allowed:
114
115 nil - do not highlight the message at all
116 'nick - highlight pal's nickname only
117 'all - highlight the entire message from pal
118
119Any other value disables pal highlighting altogether."
120 :group 'erc-match
121 :type '(choice (const nil)
122 (const nick)
123 (const all)))
124
125(defcustom erc-fool-highlight-type 'nick
126 "*Determines how to highlight messages by fools.
127See `erc-fools'.
128
129The following values are allowed:
130
131 nil - do not highlight the message at all
132 'nick - highlight fool's nickname only
133 'all - highlight the entire message from fool
134
135Any other value disables fool highlighting altogether."
136 :group 'erc-match
137 :type '(choice (const nil)
138 (const nick)
139 (const all)))
140
141(defcustom erc-keyword-highlight-type 'keyword
142 "*Determines how to highlight messages containing keywords.
143See variable `erc-keywords'.
144
145The following values are allowed:
146
147 'keyword - highlight keyword only
148 'all - highlight the entire message containing keyword
149
150Any other value disables keyword highlighting altogether."
151 :group 'erc-match
152 :type '(choice (const nil)
153 (const keyword)
154 (const all)))
155
156(defcustom erc-dangerous-host-highlight-type 'nick
157 "*Determines how to highlight messages by nicks from dangerous-hosts.
158See `erc-dangerous-hosts'.
159
160The following values are allowed:
161
162 'nick - highlight nick from dangerous-host only
163 'all - highlight the entire message from dangerous-host
164
165Any other value disables dangerous-host highlighting altogether."
166 :group 'erc-match
167 :type '(choice (const nil)
168 (const nick)
169 (const all)))
170
171
172(defcustom erc-log-matches-types-alist '((keyword . "ERC Keywords"))
173 "Alist telling ERC where to log which match types.
174Valid match type keys are:
175- keyword
176- pal
177- dangerous-host
178- fool
179- current-nick
180
181The other element of each cons pair in this list is the buffer name to
182use for the logged message."
183 :group 'erc-match
184 :type '(repeat (cons (choice :tag "Key"
185 (const keyword)
186 (const pal)
187 (const dangerous-host)
188 (const fool)
189 (const current-nick))
190 (string :tag "Buffer name"))))
191
192(defcustom erc-log-matches-flag 'away
193 "Flag specifying when matched message logging should happen.
194When nil, don't log any matched messages.
195When t, log messages.
196When 'away, log messages only when away."
197 :group 'erc-match
198 :type '(choice (const nil)
199 (const away)
200 (const t)))
201
202(defcustom erc-log-match-format "%t<%n:%c> %m"
203 "Format for matched Messages.
204This variable specifies how messages in the corresponding log buffers will
205be formatted. The various format specs are:
206
207%t Timestamp (uses `erc-timestamp-format' if non-nil or \"[%Y-%m-%d %H:%M] \")
208%n Nickname of sender
209%u Nickname!user@host of sender
210%c Channel in which this was received
211%m Message"
212 :group 'erc-match
213 :type 'string)
214
215(defcustom erc-beep-match-types '(current-nick)
216 "Types of matches to beep for when a match occurs.
217The function `erc-beep-on-match' needs to be added to `erc-text-matched-hook'
218for beeping to work."
219 :group 'erc-match
220 :type '(choice (repeat :tag "Beep on match" (choice
221 (const current-nick)
222 (const keyword)
223 (const pal)
224 (const dangerous-host)
225 (const fool)))
226 (const :tag "Don't beep" nil)))
227
228(defcustom erc-text-matched-hook '(erc-log-matches)
229 "Hook run when text matches a given match-type.
230Functions in this hook are passed as arguments:
231\(match-type nick!user@host message) where MATCH-TYPE is a symbol of:
232current-nick, keyword, pal, dangerous-host, fool"
233 :options '(erc-log-matches erc-hide-fools erc-beep-on-match)
234 :group 'erc-match
235 :type 'hook)
236
237;; Internal variables:
238
239;; This is exactly the same as erc-button-syntax-table. Should we
240;; just put it in erc.el
241(defvar erc-match-syntax-table
242 (let ((table (make-syntax-table)))
243 (modify-syntax-entry ?\( "w" table)
244 (modify-syntax-entry ?\) "w" table)
245 (modify-syntax-entry ?\[ "w" table)
246 (modify-syntax-entry ?\] "w" table)
247 (modify-syntax-entry ?\{ "w" table)
248 (modify-syntax-entry ?\} "w" table)
249 (modify-syntax-entry ?` "w" table)
250 (modify-syntax-entry ?' "w" table)
251 (modify-syntax-entry ?^ "w" table)
252 (modify-syntax-entry ?- "w" table)
253 (modify-syntax-entry ?_ "w" table)
254 (modify-syntax-entry ?| "w" table)
255 (modify-syntax-entry ?\\ "w" table)
256 table)
257 "Syntax table used when highlighting messages.
258This syntax table should make all the legal nick characters word
259constituents.")
260
261;; Faces:
262
263(defface erc-current-nick-face '((t (:bold t :foreground "DarkTurquoise")))
264 "ERC face for occurrences of your current nickname."
265 :group 'erc-faces)
266
267(defface erc-dangerous-host-face '((t (:foreground "red")))
268 "ERC face for people on dangerous hosts.
269See `erc-dangerous-hosts'."
270 :group 'erc-faces)
271
272(defface erc-pal-face '((t (:bold t :foreground "Magenta")))
273 "ERC face for your pals.
274See `erc-pals'."
275 :group 'erc-faces)
276
277(defface erc-fool-face '((t (:foreground "dim gray")))
278 "ERC face for fools on the channel.
279See `erc-fools'."
280 :group 'erc-faces)
281
282(defface erc-keyword-face '((t (:bold t :foreground "pale green")))
283 "ERC face for your keywords.
284Note that this is the default face to use if
285`erc-keywords' does not specify another."
286 :group 'erc-faces)
287
288;; Functions:
289
290(defun erc-add-entry-to-list (list prompt &optional completions)
291 "Add an entry interactively to a list.
292LIST must be passed as a symbol
293The query happens using PROMPT.
294Completion is performed on the optional alist COMPLETIONS."
295 (let ((entry (completing-read
296 prompt
297 completions
298 (lambda (x)
299 (not (erc-member-ignore-case (car x) (symbol-value list)))))))
300 (if (erc-member-ignore-case entry (symbol-value list))
301 (error (format "\"%s\" is already on the list" entry))
302 (set list (cons entry (symbol-value list))))))
303
304(defun erc-remove-entry-from-list (list prompt)
305 "Remove an entry interactively from a list.
306LIST must be passed as a symbol.
307The elements of LIST can be strings, or cons cells where the
308car is the string."
309 (let* ((alist (mapcar (lambda (x)
310 (if (listp x)
311 x
312 (list x)))
313 (symbol-value list)))
314 (entry (completing-read
315 prompt
316 alist
317 nil
318 t)))
319 (if (erc-member-ignore-case entry (symbol-value list))
320 ;; plain string
321 (set list (delete entry (symbol-value list)))
322 ;; cons cell
323 (set list (delete (assoc entry (symbol-value list))
324 (symbol-value list))))))
325
326;;;###autoload
327(defun erc-add-pal ()
328 "Add pal interactively to `erc-pals'."
329 (interactive)
330 (erc-add-entry-to-list 'erc-pals "Add pal: " (erc-get-server-nickname-alist)))
331
332;;;###autoload
333(defun erc-delete-pal ()
334 "Delete pal interactively to `erc-pals'."
335 (interactive)
336 (erc-remove-entry-from-list 'erc-pals "Delete pal: "))
337
338;;;###autoload
339(defun erc-add-fool ()
340 "Add fool interactively to `erc-fools'."
341 (interactive)
342 (erc-add-entry-to-list 'erc-fools "Add fool: "
343 (erc-get-server-nickname-alist)))
344
345;;;###autoload
346(defun erc-delete-fool ()
347 "Delete fool interactively to `erc-fools'."
348 (interactive)
349 (erc-remove-entry-from-list 'erc-fools "Delete fool: "))
350
351;;;###autoload
352(defun erc-add-keyword ()
353 "Add keyword interactively to `erc-keywords'."
354 (interactive)
355 (erc-add-entry-to-list 'erc-keywords "Add keyword: "))
356
357;;;###autoload
358(defun erc-delete-keyword ()
359 "Delete keyword interactively to `erc-keywords'."
360 (interactive)
361 (erc-remove-entry-from-list 'erc-keywords "Delete keyword: "))
362
363;;;###autoload
364(defun erc-add-dangerous-host ()
365 "Add dangerous-host interactively to `erc-dangerous-hosts'."
366 (interactive)
367 (erc-add-entry-to-list 'erc-dangerous-hosts "Add dangerous-host: "))
368
369;;;###autoload
370(defun erc-delete-dangerous-host ()
371 "Delete dangerous-host interactively to `erc-dangerous-hosts'."
372 (interactive)
373 (erc-remove-entry-from-list 'erc-dangerous-hosts "Delete dangerous-host: "))
374
375(defun erc-match-current-nick-p (nickuserhost msg)
376 "Check whether the current nickname is in MSG.
377NICKUSERHOST will be ignored."
378 (with-syntax-table erc-match-syntax-table
379 (and msg
380 (string-match (concat "\\b"
381 (regexp-quote (erc-current-nick))
382 "\\b")
383 msg))))
384
385(defun erc-match-pal-p (nickuserhost msg)
386 "Check whether NICKUSERHOST is in `erc-pals'.
387MSG will be ignored."
388 (and nickuserhost
389 (erc-list-match erc-pals nickuserhost)))
390
391(defun erc-match-fool-p (nickuserhost msg)
392 "Check whether NICKUSERHOST is in `erc-fools' or MSG is directed at a fool."
393 (and msg nickuserhost
394 (or (erc-list-match erc-fools nickuserhost)
395 (erc-match-directed-at-fool-p msg))))
396
397(defun erc-match-keyword-p (nickuserhost msg)
398 "Check whether any keyword of `erc-keywords' matches for MSG.
399NICKUSERHOST will be ignored."
400 (and msg
401 (erc-list-match
402 (mapcar (lambda (x)
403 (if (listp x)
404 (car x)
405 x))
406 erc-keywords)
407 msg)))
408
409(defun erc-match-dangerous-host-p (nickuserhost msg)
410 "Check whether NICKUSERHOST is in `erc-dangerous-hosts'.
411MSG will be ignored."
412 (and nickuserhost
413 (erc-list-match erc-dangerous-hosts nickuserhost)))
414
415(defun erc-match-directed-at-fool-p (msg)
416 "Check whether MSG is directed at a fool.
417In order to do this, every entry in `erc-fools' will be used.
418In any of the following situations, MSG is directed at an entry FOOL:
419
420- MSG starts with \"FOOL: \" or \"FOO, \"
421- MSG contains \", FOOL.\" (actually, \"\\s. FOOL\\s.\")"
422 (let ((fools-beg (mapcar (lambda (entry)
423 (concat "^" entry "[:,] "))
424 erc-fools))
425 (fools-end (mapcar (lambda (entry)
426 (concat "\\s. " entry "\\s."))
427 erc-fools)))
428 (or (erc-list-match fools-beg msg)
429 (erc-list-match fools-end msg))))
430
431(defun erc-get-parsed-vector (point)
432 "Return the whole parsed vector on POINT."
433 (get-text-property point 'erc-parsed))
434
435(defun erc-get-parsed-vector-nick (vect)
436 "Return nickname in the parsed vector VECT."
437 (let* ((untreated-nick (and vect (erc-response.sender vect)))
438 (maybe-nick (when untreated-nick
439 (car (split-string untreated-nick "!")))))
440 (when (and (not (null maybe-nick))
441 (erc-is-valid-nick-p maybe-nick))
442 untreated-nick)))
443
444(defun erc-get-parsed-vector-type (vect)
445 "Return message type in the parsed vector VECT."
446 (and vect
447 (erc-response.command vect)))
448
449(defun erc-match-message ()
450 "Mark certain keywords in a region.
451Use this defun with `erc-insert-modify-hook'."
452 ;; This needs some refactoring.
453 (goto-char (point-min))
454 (let* ((to-match-nick-dep '("pal" "fool" "dangerous-host"))
455 (to-match-nick-indep '("keyword" "current-nick"))
456 (vector (erc-get-parsed-vector (point-min)))
457 (nickuserhost (erc-get-parsed-vector-nick vector))
458 (nickname (and nickuserhost
459 (nth 0 (erc-parse-user nickuserhost))))
460 (old-pt (point))
461 (nick-beg (and nickname
462 (re-search-forward (regexp-quote nickname)
463 (point-max) t)
464 (match-beginning 0)))
465 (nick-end (when nick-beg
466 (match-end 0)))
467 (message (buffer-substring (if (and nick-end
468 (<= (+ 2 nick-end) (point-max)))
469 (+ 2 nick-end)
470 (point-min))
471 (point-max))))
472 (when vector
473 (mapc
474 (lambda (match-type)
475 (goto-char (point-min))
476 (let* ((match-prefix (concat "erc-" match-type))
477 (match-pred (intern (concat "erc-match-" match-type "-p")))
478 (match-htype (eval (intern (concat match-prefix
479 "-highlight-type"))))
480 (match-regex (if (string= match-type "current-nick")
481 (regexp-quote (erc-current-nick))
482 (eval (intern (concat match-prefix "s")))))
483 (match-face (intern (concat match-prefix "-face"))))
484 (when (funcall match-pred nickuserhost message)
485 (cond
486 ;; Highlight the nick of the message
487 ((and (eq match-htype 'nick)
488 nick-end)
489 (erc-put-text-property
490 nick-beg nick-end
491 'face match-face (current-buffer)))
492 ;; Highlight the nick of the message, or the current
493 ;; nick if there's no nick in the message (e.g. /NAMES
494 ;; output)
495 ((and (string= match-type "current-nick")
496 (eq match-htype 'nick-or-keyword))
497 (if nick-end
498 (erc-put-text-property
499 nick-beg nick-end
500 'face match-face (current-buffer))
501 (goto-char (+ 2 (or nick-end
502 (point-min))))
503 (while (re-search-forward match-regex nil t)
504 (erc-put-text-property (match-beginning 0) (match-end 0)
505 'face match-face))))
506 ;; Highlight the whole message
507 ((eq match-htype 'all)
508 (erc-put-text-property
509 (point-min) (point-max)
510 'face match-face (current-buffer)))
511 ;; Highlight all occurrences of the word to be
512 ;; highlighted.
513 ((and (string= match-type "keyword")
514 (eq match-htype 'keyword))
515 (mapc (lambda (elt)
516 (let ((regex elt)
517 (face match-face))
518 (when (consp regex)
519 (setq regex (car elt)
520 face (cdr elt)))
521 (goto-char (+ 2 (or nick-end
522 (point-min))))
523 (while (re-search-forward regex nil t)
524 (erc-put-text-property
525 (match-beginning 0) (match-end 0)
526 'face face))))
527 match-regex))
528 ;; Highlight all occurrences of our nick.
529 ((and (string= match-type "current-nick")
530 (eq match-htype 'keyword))
531 (goto-char (+ 2 (or nick-end
532 (point-min))))
533 (while (re-search-forward match-regex nil t)
534 (erc-put-text-property (match-beginning 0) (match-end 0)
535 'face match-face)))
536 ;; Else twiddle your thumbs.
537 (t nil))
538 (run-hook-with-args
539 'erc-text-matched-hook
540 (intern match-type)
541 (or nickuserhost
542 (concat "Server:" (erc-get-parsed-vector-type vector)))
543 message))))
544 (if nickuserhost
545 (append to-match-nick-dep to-match-nick-indep)
546 to-match-nick-indep)))))
547
548(defun erc-log-matches (match-type nickuserhost message)
549 "Log matches in a separate buffer, determined by MATCH-TYPE.
550The behaviour of this function is controlled by the variables
551`erc-log-matches-types-alist' and `erc-log-matches-flag'. Specify the
552match types which should be logged in the former, and
553deactivate/activate match logging in the latter. See
554`erc-log-match-format'."
555 (let ((match-buffer-name (cdr (assq match-type
556 erc-log-matches-types-alist)))
557 (nick (nth 0 (erc-parse-user nickuserhost))))
558 (when (and
559 (or (eq erc-log-matches-flag t)
560 (and (eq erc-log-matches-flag 'away)
561 erc-away))
562 match-buffer-name)
563 (let ((line (format-spec erc-log-match-format
564 (format-spec-make
565 ?n nick
566 ?t (format-time-string
567 (or (and (boundp 'erc-timestamp-format)
568 erc-timestamp-format)
569 "[%Y-%m-%d %H:%M] "))
570 ?c (or (erc-default-target) "")
571 ?m message
572 ?u nickuserhost))))
573 (with-current-buffer (erc-log-matches-make-buffer match-buffer-name)
574 (toggle-read-only -1)
575 (point-max)
576 (insert line)
577 (toggle-read-only 1))))))
578
579(defun erc-log-matches-make-buffer (name)
580 "Create or get a log-matches buffer named NAME and return it."
581 (let* ((buffer-already (get-buffer name))
582 (buffer (or buffer-already
583 (get-buffer-create name))))
584 (with-current-buffer buffer
585 (unless buffer-already
586 (insert " == Type \"q\" to dismiss messages ==\n")
587 (erc-view-mode-enter nil (lambda (buffer)
588 (when (y-or-n-p "Discard messages?")
589 (kill-buffer buffer)))))
590 buffer)))
591
592(defun erc-log-matches-come-back (proc parsed)
593 "Display a notice that messages were logged while away."
594 (when (and erc-away
595 (eq erc-log-matches-flag 'away))
596 (mapc
597 (lambda (match-type)
598 (let ((buffer (get-buffer (cdr match-type)))
599 (buffer-name (cdr match-type)))
600 (when buffer
601 (let* ((last-msg-time (erc-emacs-time-to-erc-time
602 (with-current-buffer buffer
603 (get-text-property (1- (point-max))
604 'timestamp))))
605 (away-time (erc-emacs-time-to-erc-time erc-away)))
606 (when (and away-time last-msg-time
607 (erc-time-gt last-msg-time away-time))
608 (erc-display-message
609 nil 'notice 'active
610 (format "You have logged messages waiting in \"%s\"."
611 buffer-name))
612 (erc-display-message
613 nil 'notice 'active
614 (format "Type \"C-c C-k %s RET\" to view them."
615 buffer-name)))))))
616 erc-log-matches-types-alist))
617 nil)
618
619; This handler must be run _before_ erc-process-away is.
620(add-hook 'erc-server-305-functions 'erc-log-matches-come-back nil)
621
622(defun erc-go-to-log-matches-buffer ()
623 "Interactively open an erc-log-matches buffer."
624 (interactive)
625 (let ((buffer-name (completing-read "Switch to ERC Log buffer: "
626 (mapcar (lambda (x)
627 (cons (cdr x) t))
628 erc-log-matches-types-alist)
629 (lambda (buffer-cons)
630 (get-buffer (car buffer-cons))))))
631 (switch-to-buffer buffer-name)))
632
633(define-key erc-mode-map "\C-c\C-k" 'erc-go-to-log-matches-buffer)
634
635(defun erc-hide-fools (match-type nickuserhost message)
636 "Hide foolish comments.
637This function should be called from `erc-text-matched-hook'."
638 (when (eq match-type 'fool)
639 (erc-put-text-properties (point-min) (point-max)
640 '(invisible intangible)
641 (current-buffer))))
642
643(defun erc-beep-on-match (match-type nickuserhost message)
644 "Beep when text matches.
645This function is meant to be called from `erc-text-matched-hook'."
646 (when (member match-type erc-beep-match-types)
647 (beep)))
648
649(provide 'erc-match)
650
651;;; erc-match.el ends here
652;;
653;; Local Variables:
654;; indent-tabs-mode: t
655;; tab-width: 8
656;; End:
657
658;; arch-tag: 1f1f595e-abcc-4b0b-83db-598a1d3f0f82
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
new file mode 100644
index 00000000000..8e1f81adf75
--- /dev/null
+++ b/lisp/erc/erc-menu.el
@@ -0,0 +1,121 @@
1;; erc-menu.el -- Menu-bar definitions for ERC
2
3;; Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm, processes, menu
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcMenu
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; Loading this file defines a menu for ERC.
29
30;;; Code:
31
32(require 'easymenu)
33
34(defvar erc-menu-definition
35 (list "IRC"
36 ["Connect to server..." erc-select t]
37 ["Disconnect from server..." erc-quit-server erc-server-connected]
38 "-"
39 ["List channels..." erc-cmd-LIST
40 (and erc-server-connected (fboundp 'erc-cmd-LIST))]
41 ["Join channel..." erc-join-channel 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)]
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 "-"
78 (list "Pals, fools and other keywords"
79 ["Add pal..." erc-add-pal]
80 ["Delete pal..." erc-delete-pal]
81 ["Add fool..." erc-add-fool]
82 ["Delete fool..." erc-delete-fool]
83 ["Add keyword..." erc-add-keyword]
84 ["Delete keyword..." erc-delete-keyword]
85 ["Add dangerous host..." erc-add-dangerous-host]
86 ["Delete dangerous host..." erc-delete-dangerous-host])
87 "-"
88 (list "IRC services"
89 ["Identify to NickServ..." erc-nickserv-identify
90 (and erc-server-connected (functionp 'erc-nickserv-identify))])
91 "-"
92 ["Save buffer in log" erc-save-buffer-in-logs
93 (fboundp 'erc-save-buffer-in-logs)]
94 ["Truncate buffer" erc-truncate-buffer (fboundp 'erc-truncate-buffer)]
95 "-"
96 ["Customize ERC" (customize-group 'erc) t]
97 ["Enable/Disable ERC Modules" (customize-variable 'erc-modules) t]
98 ["Show ERC version" erc-version t])
99 "ERC menu definition.")
100
101;; `erc-mode-map' must be defined before doing this
102(eval-after-load "erc"
103 '(progn
104 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
105 (easy-menu-add erc-menu erc-mode-map)
106
107 ;; for some reason the menu isn't automatically added to the menu bar
108 (when (featurep 'xemacs)
109 (add-hook 'erc-mode-hook
110 (lambda () (easy-menu-add erc-menu erc-mode-map))))))
111
112(provide 'erc-menu)
113
114;;; erc-menu.el ends here
115;;
116;; Local Variables:
117;; indent-tabs-mode: t
118;; tab-width: 8
119;; End:
120
121;; arch-tag: 671219f2-b082-4753-a185-1d0c7e0c05bd
diff --git a/lisp/erc/erc-nets.el b/lisp/erc/erc-nets.el
new file mode 100644
index 00000000000..716a42996d5
--- /dev/null
+++ b/lisp/erc/erc-nets.el
@@ -0,0 +1,861 @@
1;;; erc-nets.el --- IRC networks
2
3;; Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@lexx.delysid.org>
6;; Keywords: comm
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This file deals with IRC networks.
28;;
29;; Usage:
30;;
31;; Put into your .emacs:
32;;
33;; (require 'erc-nets)
34;;
35;; M-x erc-server-select provides an alternative way to connect to servers by
36;; choosing networks.
37;; You can use (eq (erc-network) 'Network) if you'd like to set variables or do
38;; certain actions according to which network you're connected to.
39;; If a network you use is not listed in `erc-networks-alist', you can put
40;; (add-to-list 'erc-networks-alist '(Network "irc.server-name.net")) in your
41;; config file.
42
43;;; Code:
44
45(require 'erc)
46(eval-when-compile (require 'cl))
47
48;; Variables
49
50(defgroup erc-networks nil
51 "IRC Networks"
52 :group 'erc)
53
54(defcustom erc-server-alist
55'(("4-irc: Random server" 4-irc "4-irc.com" 6667)
56 ("A5KNet: Random server" A5KNet "irc.a5knet.com" ((6660 6669)))
57 ("AbleNet: Random server" AbleNet "irc.ablenet.org" 6667)
58 ("Accessirc: Random server" Accessirc "irc.accessirc.net" 6667)
59 ("Acestar: Random server" Acestar "irc.acestar.org" 6667)
60 ("Action-IRC: Random server" Action-IRC "irc.action-irc.net" ((6660 6669)))
61 ("AfterNET: Random server" AfterNET "irc.afternet.org" 6667)
62 ("Alternativenet: Random server" Alternativenet "irc.altnet.org" 6667)
63 ("AmigaNet: Random server" AmigaNet "irc.amiganet.org" 6667)
64 ("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
65 ("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
66 ("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
67 ("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
68 ("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
69 ("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 ))
70 ("Austnet: Random AU server" Austnet "au.austnet.org" 6667)
71 ("Austnet: Random NZ server" Austnet "nz.austnet.org" 6667)
72 ("Austnet: Random SG server" Austnet "sg.austnet.org" 6667)
73 ("Austnet: Random US server" Austnet "us.austnet.org" 6667)
74 ("AwesomeChat: Random server" AwesomeChat "irc.awesomechat.net" ((6661 6669)))
75 ("Awesomechristians: Random server" Awesomechristians "irc.awesomechristians.com" 7000)
76 ("Axenet: Random server" Axenet "irc.axenet.org" ((6660 6667)))
77 ("BeyondIRC: Random server" Beyondirc "irc.beyondirc.net" ((6660 6669)))
78 ("BGIRC: Random server" BGIRC "irc.bulgaria.org" ((6666 6669) 7000 ))
79 ("Blabbernet: Random server" Blabbernet "irc.blabber.net" (6667 7000 ))
80 ("Blitzed: Random server" Blitzed "irc.blitzed.org" (6667 7000 ))
81 ("Brasirc: Random server" Brasirc "irc.brasirc.net" ((6666 6667)))
82 ("Brasirc: BR, PA, Belem" Brasirc "irc.libnet.com.br" ((6666 6668) 7777 8002 ))
83 ("BRASnet: Random European server" BRASnet "eu.brasnet.org" ((6665 6669)))
84 ("BRASnet: Random US server" BRASnet "us.brasnet.org" ((6665 6669)))
85 ("BubbleNet: Random server" BubbleNet "irc.bubblenet.org" ((6667 6669)))
86 ("CCnet: Random server" CCnet "irc.cchat.net" (6667 7000 ))
87 ("CCnet: US, TX, Dallas" CCnet "irc2.cchat.net" (6667 7000 ))
88 ("Chat-Net: Random server" Chat-Net "irc.chat-net.org" 6667)
89 ("Chat-Solutions: Random server" Chat-Solutions "irc.chat-solutions.org" 6667)
90 ("Chatcafe: Random server" Chatcafe "irc.chatcafe.net" 6667)
91 ("Chatchannel: Random server" Chatchannel "irc.chatchannel.org" ((6666 6669) 7000 ))
92 ("ChatCircuit: Random server" ChatCircuit "irc.chatcircuit.com" 6668)
93 ("Chatlink: Random server" Chatlink "irc.chatlink.org" 6667)
94 ("Chatnet: Random AU server" Chatnet "au.chatnet.org" 6667)
95 ("Chatnet: Random EU server" Chatnet "eu.chatnet.org" 6667)
96 ("Chatnet: Random US server" Chatnet "us.chatnet.org" 6667)
97 ("ChatNut: Random server" ChatNut "irc.chatnut.net" (6667 7000 ))
98 ("Chatpinoy: Random server" Chatpinoy "irc.chatpinoy.com" 6667)
99 ("ChatPR: Random server" ChatPR "irc.chatpr.org" 6667)
100 ("Chatroom: Random server" Chatroom "irc.chatroom.org" 6667)
101 ("Chatster: Random server" Chatster "irc.chatster.org" 6667)
102 ("ChatX: Random server" ChatX "irc.chatx.net" 6667)
103 ("China263: Random server" China263 "irc.263.net" 6667)
104 ("Cineplex1: Random server" Cineplex1 "irc.cineplex1.com" ((6666 6668)))
105 ("CNN: CNN News discussions" CNN "chat.cnn.com" ((6667 6669) 7000 ))
106 ("CobraNet: Random server" CobraNet "irc.cobra.net" 6667)
107 ("Coolchat: Random server" Coolchat "irc.coolchat.net" 6667)
108 ("Criten: Random server" Criten "irc.criten.net" 6667)
109 ("Cyberchat: Random server" Cyberchat "irc.cyberchat.org" (6667 6668 ))
110 ("CyGanet: Random server" CyGanet "irc.cyga.net" 6667)
111 ("DALnet: AS, MY, Coins" DALnet "coins.dal.net" ((6663 6668) 7000 ))
112 ("DALnet: CA, ON, Sodre" DALnet "sodre.on.ca.dal.net" ((6661 6669) 7000 ))
113 ("DALnet: EU, DE, Nexgo" DALnet "nexgo.de.eu.dal.net" ((6664 6669) 7000 ))
114 ("DALnet: EU, NO, Powertech" DALnet "powertech.no.eu.dal.net" ((6666 6667) 7000 ))
115 ("DALnet: EU, SE, Borg" DALnet "borg.se.eu.dal.net" (6667 7000 ))
116 ("DALnet: EU, SE, Ced" DALnet "ced.se.eu.dal.net" (6667 7000 ))
117 ("DALnet: US, GA, Astro" DALnet "astro.ga.us.dal.net" ((6661 6669) 7000 ))
118 ("DALnet: US, GA, Dragons" DALnet "dragons.ga.us.dal.net" ((6661 6669) 7000 ))
119 ("DALnet: US, GA, Elysium" DALnet "elysium.ga.us.dal.net" ((6661 6669) 7000 ))
120 ("DALnet: US, MA, Twisted" DALnet "twisted.ma.us.dal.net" ((6660 6669) 7001 7002 ))
121 ("DALnet: US, MO, Global" DALnet "global.mo.us.dal.net" ((6661 6669) 7000 ))
122 ("DALnet: US, NJ, Liberty" DALnet "liberty.nj.us.dal.net" ((6662 6669) 7000 ))
123 ("DALnet: US, VA, Wombat" DALnet "wombat.va.us.dal.net" ((6661 6669) 7000 ))
124 ("DALnet: Random EU server" DALnet "irc.eu.dal.net" 6667)
125 ("DALnet: Random US server" DALnet "irc.dal.net" ((6660 6667)))
126 ("Dark-Tou-Net: Random server" Dark-Tou-Net "irc.d-t-net.de" 6667)
127 ("Darkfire: Random server" Darkfire "irc.darkfire.net" (6667 7000 8000 ))
128 ("DarkMyst: Random server" DarkMyst "irc.darkmyst.org" 6667)
129 ("Darkserv: Random server" Darkserv "irc.darkserv.net" 6667)
130 ("Darksystem: Random server" Darksystem "irc.darksystem.com" 6667)
131 ("Darktree: Random server" Darktree "irc.darktree.net" 6667)
132 ("DayNet: Random server" DayNet "irc.daynet.org" 6667)
133 ("Deepspace: Disability network" Deepspace "irc.deepspace.org" 6667)
134 ("Different: Random server" Different "irc.different.net" 6667)
135 ("Digarix: Random server" Digarix "irc.digarix.net" 6667)
136 ("Digatech: Random server" Digatech "irc.digatech.net" 6667)
137 ("Digital-Base: Random server" Digital-Base "irc.digital-base.net" ((6660 7000)))
138 ("Digitalirc: Random server" Digitalirc "irc.digitalirc.net" 6667)
139 ("Discussioni: Random server" Discussioni "irc.discussioni.org" ((6666 6669)))
140 ("DorukNet: TR, Istanbul" DorukNet "irc.doruk.net.tr" ((6660 6669) 7000 8888 ))
141 ("Dreamcast: Random server" Dreamcast "irc0.dreamcast.com" 6667)
142 ("DWChat: Random server" DWChat "irc.dwchat.net" 6667)
143 ("Dynastynet: Random server" Dynastynet "irc.dynastynet.net" 6667)
144 ("EFnet: CA, AB, Edmonton (arcti)" EFnet "irc.arcti.ca" 6667)
145 ("EFnet: CA, AB, Edmonton (mpls)" EFnet "irc.mpls.ca" ((6660 6669)))
146 ("EFnet: CA, ON, Toronto" EFnet "irc2.magic.ca" 6667)
147 ("EFnet: CA, QB, Montreal" EFnet "irc.qeast.net" 6667)
148 ("EFnet: EU, DK, Aarhus" EFnet "irc.inet.tele.dk" 6667)
149 ("EFnet: EU, FI, Helsinki" EFnet "efnet.cs.hut.fi" 6667)
150 ("EFnet: EU, FR, Paris" EFnet "irc.isdnet.fr" ((6667 6669)))
151 ("EFnet: EU, NL, Amsterdam" EFnet "efnet.vuurwerk.nl" 6667)
152 ("EFnet: EU, NO, Homelien" EFnet "irc.homelien.no" (5190 (6666 6667) (7000 7001) ))
153 ("EFnet: EU, NO, Oslo" EFnet "irc.daxnet.no" ((6666 7000)))
154 ("EFnet: EU, PL, Warszawa" EFnet "irc.efnet.pl" 6667)
155 ("EFnet: EU, RU, Moscow" EFnet "irc.rt.ru" ((6661 6669)))
156 ("EFnet: EU, SE, Dalarna" EFnet "irc.du.se" ((6666 6669)))
157 ("EFnet: EU, SE, Gothenberg" EFnet "irc.hemmet.chalmers.se" ((6666 7000)))
158 ("EFnet: EU, SE, Sweden" EFnet "irc.light.se" 6667)
159 ("EFnet: EU, UK, London (carrier)" EFnet "irc.carrier1.net.uk" ((6666 6669)))
160 ("EFnet: EU, UK, London (demon)" EFnet "efnet.demon.co.uk" ((6665 6669)))
161 ("EFnet: ME, IL, Inter" EFnet "irc.inter.net.il" ((6665 6669)))
162 ("EFnet: US, AZ, Phoenix" EFnet "irc.easynews.com" (6660 (6665 6667) 7000 ))
163 ("EFnet: US, CA, San Jose" EFnet "irc.concentric.net" ((6665 6668)))
164 ("EFnet: US, CA, San Luis Obispo" EFnet "irc.prison.net" ((6666 6667)))
165 ("EFnet: US, GA, Atlanta" EFnet "irc.mindspring.com" ((6660 6669)))
166 ("EFnet: US, MI, Ann Arbor" EFnet "irc.umich.edu" 6667)
167 ("EFnet: US, MN, Twin Cities" EFnet "irc.umn.edu" ((6665 6669)))
168 ("EFnet: US, NY, Mineola" EFnet "irc.lightning.net" ((6665 7000)))
169 ("EFnet: US, NY, New York (east)" EFnet "irc.east.gblx.net" 6667)
170 ("EFnet: US, NY, New York (flamed)" EFnet "irc.flamed.net" ((6665 6669)))
171 ("EFnet: US, TX, Houston" EFnet "ircd.lagged.org" ((6660 6669)))
172 ("EFnet: US, VA, Ashburn" EFnet "irc.secsup.uu.net" ((6665 6669) 8080 ))
173 ("EFnet: Random AU server" EFnet "au.rr.efnet.net" 6667)
174 ("EFnet: Random CA server" EFnet "ca.rr.efnet.net" 6667)
175 ("EFnet: Random EU server" EFnet "eu.rr.efnet.net" 6667)
176 ("EFnet: Random US server" EFnet "us.rr.efnet.net" 6667)
177 ("EgyptianIRC: Random server" EgyptianIRC "irc.egyptianirc.net" ((6667 6669)))
178 ("Eircnet: Random server" Eircnet "irc.eircnet.org" ((6660 6669) 7000 ))
179 ("Eleethal: Random server" Eleethal "irc.eleethal.com" ((6660 6669) 7000 ))
180 ("EntertheGame: Random server" EntertheGame "irc.enterthegame.com" ((6667 6669)))
181 ("EpiKnet: Random server" EpiKnet "irc.epiknet.org" ((6660 6669) 7000 7001 ))
182 ("EsperNet: Random server" EsperNet "irc.esper.net" (5555 (6667 6669) ))
183 ("Esprit: Random server" Esprit "irc.esprit.net" 6667)
184 ("euIRC: Random server" euIRC "irc.euirc.net" ((6665 6669)))
185 ("Evilzinc: Random server" Evilzinc "irc.evilzinc.net" ((6660 6669) 7000 8000 ))
186 ("ExodusIRC: Random server" ExodusIRC "irc.exodusirc.net" ((6660 6669)))
187 ("FDFnet: Random server" FDFnet "irc.fdfnet.net" ((6666 6668) 9999 ))
188 ("FEFnet: Random server" FEFnet "irc.fef.net" 6667)
189 ("Financialchat: Random server" Financialchat "irc.financialchat.com" ((6667 6669) 7000 ))
190 ("Forestnet: Random server" Forestnet "irc.forestnet.org" (6667 7000 ))
191 ("ForeverChat: Random server" ForeverChat "irc.foreverchat.net" ((6660 6669) 7000 ))
192 ("Fraggers: Random server" Fraggers "irc.fraggers.co.uk" ((6661 6669) (7000 7001) ))
193 ("FreedomChat: Random server" FreedomChat "chat.freedomchat.net" 6667)
194 ("FreedomIRC: Random server" FreedomIRC "irc.freedomirc.net" 6667)
195 ("Freenode: Random server" freenode "irc.freenode.net" 6667)
196 ("Freenode: Random EU server" freenode "irc.eu.freenode.net" 6667)
197 ("Freenode: Random US server" freenode "irc.us.freenode.net" 6667)
198 ("FunNet: Random server" FunNet "irc.funnet.org" 6667)
199 ("Galaxynet: Random server" GalaxyNet "irc.galaxynet.org" ((6662 6668) 7000 ))
200 ("Galaxynet: AU, NZ, Auckland" GalaxyNet "auckland.nz.galaxynet.org" ((6661 6669)))
201 ("Galaxynet: EU, BE, Online" GalaxyNet "online.be.galaxynet.org" ((6661 6669)))
202 ("Galaxynet: US, FL, Florida" GalaxyNet "gymnet.us.galaxynet.org" ((6661 6669)))
203 ("Gamesnet: Random east US server" Gamesnet "east.gamesnet.net" 6667)
204 ("Gamesnet: Random west US server" Gamesnet "west.gamesnet.net" 6667)
205 ("GammaForce: Random server" GammaForce "irc.gammaforce.org" ((6660 6669) 7000 ))
206 ("GIKInet: Random server" GIKInet "irc.giki.edu.pk" 6667)
207 ("GizNet: Random server" GizNet "irc.giznet.org" ((6666 6669) 7000 ))
208 ("Globalchat: Random server" Globalchat "irc.globalchat.org" 6667)
209 ("GlobIRC: Random server" GlobIRC "irc.globirc.net" ((6666 6668) 9999 ))
210 ("Goldchat: Random server" Goldchat "irc.goldchat.nl" ((6660 6669) 7000 ))
211 ("Goodchatting: Random server" Goodchatting "irc.goodchatting.com" ((6661 6669) 7000 ))
212 ("GravityLords: Random server" GravityLords "irc.gravitylords.net" 6667)
213 ("Grnet: Random EU server" GRnet "gr.irc.gr" (6667 7000 ))
214 ("Grnet: Random server" GRnet "srv.irc.gr" (6667 7000 ))
215 ("Grnet: Random US server" GRnet "us.irc.gr" (6667 7000 ))
216 ("GulfChat: Random server" GulfChat "irc.gulfchat.net" ((6660 6669)))
217 ("HabberNet: Random server" HabberNet "irc.habber.net" 6667)
218 ("HanIRC: Random server" HanIRC "irc.hanirc.org" 6667)
219 ("Hellenicnet: Random server" Hellenicnet "irc.mirc.gr" (6667 7000 ))
220 ("IceNet: Random server" IceNet "irc.icenet.org.za" 6667)
221 ("ICQnet: Random server" ICQnet "irc.icq.com" 6667)
222 ("Infatech: Random server" Infatech "irc.infatech.net" ((6660 6669)))
223 ("Infinity: Random server" Infinity "irc.infinity-irc.org" 6667)
224 ("Infomatrix: Random server" Infomatrix "irc.infomatrix.net" 6667)
225 ("Inside3D: Random server" Inside3D "irc.inside3d.net" ((6661 6669)))
226 ("InterlinkChat: Random server" InterlinkChat "irc.interlinkchat.net" ((6660 6669) 7000 ))
227 ("IRC-Chile: Random server" IRC-Chile "irc.cl" 6667)
228 ("IRC-Hispano: Random server" IRC-Hispano "irc.irc-hispano.org" 6667)
229 ("IRCchat: Random server" IRCchat "irc.ircchat.tk" 6667)
230 ("IRCGate: Random server" IRCGate "irc.ircgate.net" ((6667 6669)))
231 ("IRCGeeks: Random server" IRCGeeks "irc.ircgeeks.org" ((6660 6669)))
232 ("IRChat: Random server" IRChat "irc.irchat.net" ((6660 6669)))
233 ("IrcLordz: Random server" IrcLordz "irc.irclordz.com" 6667)
234 ("IrcMalta: Random server" IrcMalta "irc.ircmalta.org" ((6660 6667)))
235 ("IRCnet: EU, FR, Random" IRCnet "irc.fr.ircnet.net" 6667)
236 ("IRCnet: EU, IT, Random" IRCnet "irc.ircd.it" ((6665 6669)))
237 ("IRCnet: AS, IL, Haifa" IRCnet "ircnet.netvision.net.il" ((6661 6668)))
238 ("IRCnet: AS, JP, Tokyo" IRCnet "irc.tokyo.wide.ad.jp" 6667)
239 ("IRCnet: AS, TW, Seed" IRCnet "irc.seed.net.tw" 6667)
240 ("IRCnet: EU, AT, Linz" IRCnet "linz.irc.at" ((6666 6668)))
241 ("IRCnet: EU, AT, Wien" IRCnet "vienna.irc.at" ((6666 6669)))
242 ("IRCnet: EU, BE, Brussels" IRCnet "irc.belnet.be" 6667)
243 ("IRCnet: EU, BE, Zaventem" IRCnet "ircnet.wanadoo.be" ((6661 6669)))
244 ("IRCnet: EU, CZ, Prague" IRCnet "irc.felk.cvut.cz" 6667)
245 ("IRCnet: EU, DE, Berlin" IRCnet "irc.fu-berlin.de" ((6665 6669)))
246 ("IRCnet: EU, DE, Dusseldorf" IRCnet "irc.freenet.de" ((6665 6669)))
247 ("IRCnet: EU, DE, Stuttgart" IRCnet "irc.belwue.de" ((6665 6669)))
248 ("IRCnet: EU, DK, Copenhagen" IRCnet "irc.ircnet.dk" 6667)
249 ("IRCnet: EU, EE, Tallinn" IRCnet "irc.estpak.ee" ((6666 6668)))
250 ("IRCnet: EU, FI, Helsinki" IRCnet "irc.cs.hut.fi" 6667)
251 ("IRCnet: EU, GR, Thessaloniki" IRCnet "irc.ee.auth.gr" ((6666 6669)))
252 ("IRCnet: EU, HU, Budapest" IRCnet "irc.elte.hu" 6667)
253 ("IRCnet: EU, IS, Reykjavik (ircnet)" IRCnet "irc.ircnet.is" ((6661 6669)))
254 ("IRCnet: EU, IS, Reykjavik (simnet)" IRCnet "irc.simnet.is" ((6661 6669)))
255 ("IRCnet: EU, IT, Rome" IRCnet "irc.tin.it" ((6665 6669)))
256 ("IRCnet: EU, NL, Amsterdam (nlnet)" IRCnet "irc.nl.uu.net" ((6660 6669)))
257 ("IRCnet: EU, NL, Amsterdam (xs4all)" IRCnet "irc.xs4all.nl" ((6660 6669)))
258 ("IRCnet: EU, NL, Enschede" IRCnet "irc.snt.utwente.nl" ((6660 6669)))
259 ("IRCnet: EU, NL, Nijmegen" IRCnet "irc.sci.kun.nl" ((6660 6669)))
260 ("IRCnet: EU, NO, Oslo" IRCnet "irc.ifi.uio.no" 6667)
261 ("IRCnet: EU, NO, Trondheim" IRCnet "irc.pvv.ntnu.no" 6667)
262 ("IRCnet: EU, PL, Lublin" IRCnet "lublin.irc.pl" ((6666 6668)))
263 ("IRCnet: EU, PL, Warsaw" IRCnet "warszawa.irc.pl" ((6666 6668)))
264 ("IRCnet: EU, RU, Moscow" IRCnet "irc.msu.ru" 6667)
265 ("IRCnet: EU, SE, Lulea" IRCnet "irc.ludd.luth.se" ((6661 6669)))
266 ("IRCnet: EU, UK, London (Demon)" IRCnet "ircnet.demon.co.uk" ((6665 6669)))
267 ("IRCnet: EU, UK, London (Easynet)" IRCnet "ircnet.easynet.co.uk" ((6666 6669)))
268 ("IRCnet: US, NY, New York" IRCnet "irc.stealth.net" ((6660 6669)))
269 ("IRCnet: Random AU server" IRCnet "au.ircnet.org" 6667)
270 ("IRCnet: Random EU server" IRCnet "eu.ircnet.org" ((6665 6668)))
271 ("IRCnet: Random US server" IRCnet "us.ircnet.org" ((6665 6668)))
272 ("IRCSoulZ: Random server" IRCSoulZ "irc.ircsoulz.net" 6667)
273 ("IRCSul: BR, PR, Maringa" IRCSul "irc.wnet.com.br" 6667)
274 ("IrcTalk: Random server" IrcTalk "irc.irctalk.net" ((6660 6669)))
275 ("Irctoo: Random server" Irctoo "irc.irctoo.net" 6667)
276 ("IRCtown: Random server" IRCtown "irc.irctown.net" ((6666 6669) 7000 ))
277 ("IRCworld: Random server" IRCworld "irc.ircworld.org" 6667)
278 ("ircXtreme: Random server" ircXtreme "irc.ircXtreme.net" ((6660 6669)))
279 ("Israelnet: Random server" Israelnet "irc.israel.net" 6667)
280 ("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
281 ("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
282 ("Kemik: Random server" Kemik "irc.kemik.net" 6667)
283 ("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 ))
284 ("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
285 ("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
286 ("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 ))
287 ("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 ))
288 ("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667)
289 ("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
290 ("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
291 ("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
292 ("LagNet: Random server" LagNet "irc.lagnet.org.za" 6667)
293 ("LagNet: AF, ZA, Cape Town" LagNet "reaper.lagnet.org.za" 6667)
294 ("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
295 ("Librenet: Random server" Librenet "irc.librenet.net" 6667)
296 ("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
297 ("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 ))
298 ("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669)))
299 ("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667)
300 ("Mavra: Random server" Mavra "irc.mavra.net" 6667)
301 ("MediaDriven: Random server" MediaDriven "irc.mediadriven.com" ((6667 6669)))
302 ("mIRC-X: Random server" mIRC-X "irc.mircx.com" (6667 7000 ))
303 ("Morat: Random server" Morat "irc.morat.net" 6667)
304 ("MusicCity: Random server" MusicCity "chat.musiccity.com" 6667)
305 ("Mysteria: Random server" Mysteria "irc.mysteria.net" (6667 7000 ))
306 ("Mysterychat: Random server" Mysterychat "irc.mysterychat.net" ((6667 6669)))
307 ("Mystical: Random server" Mystical "irc.mystical.net" (6667 7000 ))
308 ("Narancs: Random server" Narancs "irc.narancs.com" ((6667 6669) 7000 ))
309 ("Net-France: Random server" Net-France "irc.net-france.com" 6667)
310 ("Nevernet: Random server" Nevernet "irc.nevernet.net" 6667)
311 ("Newnet: Random server" Newnet "irc.newnet.net" ((6665 6667)))
312 ("Nexusirc: Random server" Nexusirc "irc.nexusirc.org" 6667)
313 ("Nightstar: Random server" NightStar "irc.nightstar.net" ((6665 6669)))
314 ("NitrousNet: Random server" NitrousNet "irc.nitrousnet.net" 6667)
315 ("Novernet: Random server" Novernet "irc.novernet.com" ((6665 6669) 7000 ))
316 ("Nullrouted: Random server" Nullrouted "irc.nullrouted.org" ((6666 6669) 7000 ))
317 ("NullusNet: Random server" NullusNet "irc.nullus.net" 6667)
318 ("OpChat: Random server" OpChat "irc.opchat.org" ((6667 6669)))
319 ("Othernet: Random server" Othernet "irc.othernet.org" 6667)
320 ("Othernet: US, FL, Miami" Othernet "miami.fl.us.othernet.org" 6667)
321 ("Othernet: US, MO, StLouis" Othernet "stlouis.mo.us.othernet.org" 6667)
322 ("Otherside: Random server" OtherSide "irc.othersideirc.net" 6667)
323 ("Outsiderz: Random server" Outsiderz "irc.outsiderz.com" 6667)
324 ("OzOrg: AU, Perth" OzOrg "iinet.perth.oz.org" 6667)
325 ("Peacefulhaven: Random server" Peacefulhaven "irc.peacefulhaven.net" ((6660 6669) 7000 ))
326 ("PhazedIRC: Random server" PhazedIRC "irc.phazedirc.net" 6667)
327 ("Philchat: Random server" Philchat "irc.philchat.net" 6667)
328 ("phrozN: Random server" phrozN "irc.phrozn.net" 6667)
329 ("PiNet: Random server" PiNet "irc.praetorians.org" ((6665 6669)))
330 ("Pinoycentral: Random server" Pinoycentral "chat.abs-cbn.com" 6667)
331 ("Planetarion: Random server" Planetarion "irc.planetarion.com" 6667)
332 ("POLNet: Random server" POLNet "irc.ircnet.pl" 6667)
333 ("Psionics: CA, PQ, Montreal" Psionics "chat.psionics.net" ((6660 6669)))
334 ("PTirc: Random server" PTirc "irc.ptirc.com.pt" 6667)
335 ("PTlink: Random server" PTlink "irc.ptlink.net" 6667)
336 ("PTnet: Random server" PTnet "irc.ptnet.org" 6667)
337 ("QChat: Random server" QChat "irc.qchat.net" 6667)
338 ("QuakeNet: Random German server" QuakeNet "de.quakenet.org" ((6667 6669)))
339 ("QuakeNet: Random server" QuakeNet "irc.quakenet.eu.org" ((6667 6669)))
340 ("QuakeNet: Random Swedish server" QuakeNet "se.quakenet.org" ((6667 6669)))
341 ("QuakeNet: Random UK server" QuakeNet "uk.quakenet.org" ((6667 6669)))
342 ("QuakeNet: Random US server" QuakeNet "us.quakenet.org" ((6667 6669)))
343 ("Realirc: Random server" Realirc "irc.realirc.org" 6667)
344 ("RealmNET: Random server" RealmNET "irc.realmnet.com" 6667)
345 ("Rebelchat: Random server" Rebelchat "irc.rebelchat.org" 6667)
346 ("Red-Latina: Random server" Red-Latina "irc.red-latina.org" 6667)
347 ("RedLatona: Random server" RedLatona "irc.redlatona.net" (6667 6668 ))
348 ("Relicnet: Random server" Relicnet "irc.relic.net" 6667)
349 ("Rezosup: Random server" Rezosup "irc.rezosup.org" 6667)
350 ("Risanet: Random server" Risanet "irc.risanet.com" ((6667 6669)))
351 ("Rubiks: Random server" Rubiks "irc.rubiks.net" 6667)
352 ("Rusnet: EU, RU, Tomsk" Rusnet "irc.tsk.ru" ((6667 6669) (7770 7775) ))
353 ("Rusnet: EU, RU, Vladivostok" Rusnet "irc.vladivostok.ru" ((6667 6669) (7770 7775) ))
354 ("Rusnet: EU, UA, Kiev" Rusnet "irc.kar.net" ((6667 6669) (7770 7775) ))
355 ("Sandnet: Random server" Sandnet "irc.sandnet.net" ((6660 6669) 7000 ))
356 ("Scunc: Random server" Scunc "irc.scunc.net" 6667)
357 ("SerbianCafe: Random server" SerbianCafe "irc.serbiancafe.ws" ((6665 6669)))
358 ("SexNet: Random server" SexNet "irc.sexnet.org" 6667)
359 ("ShadowFire: Random server" ShadowFire "irc.shadowfire.org" 6667)
360 ("ShadowWorld: Random server" ShadowWorld "irc.shadowworld.net" 6667)
361 ("SkyNet: Random server" SkyNet "irc.bronowski.pl" ((6666 6668)))
362 ("Slashnet: Random server" Slashnet "irc.slashnet.org" 6667)
363 ("SolarStone: Random server" SolarStone "irc.solarstone.net" ((6660 6669)))
364 ("Sorcerynet: Random server" Sorcery "irc.sorcery.net" (6667 7000 9000 ))
365 ("Sorcerynet: EU, SE, Karlskrona" Sorcery "nexus.sorcery.net" (6667 7000 9000 ))
366 ("Sorcerynet: US, CA, Palo Alto" Sorcery "kechara.sorcery.net" (6667 7000 9000 ))
367 ("SourceIRC: Random server" SourceIRC "irc.sourceirc.net" ((6667 6669) 7000 ))
368 ("SpaceTronix: Random server" SpaceTronix "irc.spacetronix.net" ((6660 6669) 7000 ))
369 ("Spirit-Harmony: Random server" Spirit-Harmony "irc.spirit-harmony.com" ((6661 6669)))
370 ("StarChat: Random server" StarChat "irc.starchat.net" ((6667 6669) 7000 ))
371 ("StarEquinox: Random server" StarEquinox "irc.starequinox.net" ((6660 6669)))
372 ("StarLink: Random server" Starlink "irc.starlink.net" ((6660 6669)))
373 ("StarLink-irc: Random server" starlink-irc "irc.starlink-irc.org" 6667)
374 ("StarWars-IRC: Random server" StarWars-IRC "irc.starwars-irc.net" ((6663 6667)))
375 ("Stormdancing: Random server" Stormdancing "irc.stormdancing.net" ((6664 6669) 7000 9000 ))
376 ("Superchat: Random server" Superchat "irc.superchat.org" ((6660 6668)))
377 ("Sysopnet: Random server" Sysopnet "irc.sysopnet.org" ((6666 6668)))
378 ("Telstra: Random server" Telstra "irc.telstra.com" ((6667 6669)))
379 ("TR-net: EU, TR, Ankara" TR-net "irc.dominet.com.tr" 6667)
380 ("TR-net: EU, Tr, Istanbul" TR-net "irc.teklan.com.tr" 6667)
381 ("Tri-net: Random server" Tri-net "irc.tri-net.org" 6667)
382 ("TriLink: Random server" TriLink "irc.ft4u.net" 6667)
383 ("TurkishChat: Random server" TurkishChat "irc.turkishchat.org" ((6660 6669) 7000 ))
384 ("UberNinja: Random server" UberNinja "irc.uberninja.net" ((6667 6669)))
385 ("UICN: Random server" UICN "irc.uicn.net" 6667)
386 ("UltraIRC: Random server" UltraIRC "irc.ultrairc.net" 6667)
387 ("UnderChat: Random server" UnderChat "irc.underchat.it" ((6660 6669) 7000 ))
388 ("Undernet: CA, ON, Toronto" Undernet "toronto.on.ca.undernet.org" ((6661 6669)))
389 ("Undernet: CA, QC, Montreal" Undernet "montreal.qu.ca.undernet.org" ((6660 6669)))
390 ("Undernet: EU, AT, Graz" Undernet "graz.at.eu.undernet.org" ((6661 6669)))
391 ("Undernet: EU, BE, Antwerp" Undernet "flanders.be.eu.undernet.org" ((6660 6669)))
392 ("Undernet: EU, BE, Brussels" Undernet "brussels.be.eu.undernet.org" 6667)
393 ("Undernet: EU, CH, Geneva" Undernet "geneva.ch.eu.undernet.org" ((6660 6669) 7777 8000 ))
394 ("Undernet: EU, FR, Caen" Undernet "caen.fr.eu.undernet.org" ((6666 6669)))
395 ("Undernet: EU, NL, Diemen" Undernet "diemen.nl.eu.undernet.org" ((6660 6669)))
396 ("Undernet: EU, NL, Haarlem" Undernet "haarlem.nl.eu.undernet.org" ((6660 6669)))
397 ("Undernet: EU, NO, Oslo" Undernet "oslo.no.eu.undernet.org" ((6660 6669)))
398 ("Undernet: EU, SE, Stockholm" Undernet "stockholm.se.eu.undernet.org" ((6666 6669)))
399 ("Undernet: EU, UK, Surrey" Undernet "surrey.uk.eu.undernet.org" ((6660 6669)))
400 ("Undernet: US, AZ, Mesa" Undernet "mesa.az.us.undernet.org" ((6665 6667)))
401 ("Undernet: US, CA, San Diego" Undernet "sandiego.ca.us.undernet.org" ((6660 6670)))
402 ("Undernet: US, DC, Washington" Undernet "washington.dc.us.undernet.org" ((6660 6669)))
403 ("Undernet: US, KS, Manhattan" Undernet "manhattan.ks.us.undernet.org" ((6660 6669)))
404 ("Undernet: US, NV, Las Vegas" Undernet "lasvegas.nv.us.undernet.org" ((6660 6669)))
405 ("Undernet: US, TX, Austin" Undernet "austin.tx.us.undernet.org" ((6660 6669)))
406 ("Undernet: US, UT, Saltlake" Undernet "saltlake.ut.us.undernet.org" ((6660 6669)))
407 ("Undernet: US, VA, Arlington" Undernet "arlington.va.us.undernet.org" ((6660 6669)))
408 ("Undernet: US, VA, McLean" Undernet "mclean.va.us.undernet.org" ((6666 6669)))
409 ("Undernet: Random EU server" Undernet "eu.undernet.org" 6667)
410 ("Undernet: Random US server" Undernet "us.undernet.org" 6667)
411 ("UnderZ: Random server" UnderZ "irc.underz.org" ((6667 6668)))
412 ("UniChat: Random server" UniChat "irc.uni-chat.net" 6667)
413 ("UnionLatina: Random server" UnionLatina "irc.unionlatina.org" 6667)
414 ("Univers: Random server" Univers "irc.univers.org" ((6665 6669)))
415 ("UnixR: Random server" UnixR "irc.unixr.net" ((6667 6669)))
416 ("Vidgamechat: Random server" Vidgamechat "irc.vidgamechat.com" 6667)
417 ("VirtuaNet: Random server" VirtuaNet "irc.virtuanet.org" ((6660 6669) 7000 ))
418 ("Vitamina: Random server" Vitamina "irc.vitamina.ca" 6667)
419 ("Voila: Random server" Voila "irc.voila.fr" 6667)
420 ("Wahou: Random server" Wahou "irc.wahou.org" ((6665 6669)))
421 ("Warpednet: Random server" Warpednet "irc.warped.net" 6667)
422 ("Weaklinks: Random server" Weaklinks "irc.weaklinks.net" ((6667 6669)))
423 ("Webnet: Random server" Webnet "irc.webchat.org" ((6667 6669) 7000 ))
424 ("Webnet: US, CA, Santa Clara" Webnet "webmaster.ca.us.webchat.org" ((6661 6669)))
425 ("WinChat: Random server" WinChat "irc.winchat.net" ((6661 6669)))
426 ("WinIRC: Random server" WinIRC "irc.winirc.org" ((6667 6669) 4400 ))
427 ("WorldIRC: Random server" WorldIRC "irc.worldirc.org" ((6660 6667)))
428 ("WyldRyde: Random server" WyldRyde "irc.wyldryde.net" ((6666 6669)))
429 ("XentoniX: Random server" XentoniX "irc.xentonix.net" ((6661 6669)))
430 ("Xevion: Random server" Xevion "irc.xevion.net" (6667 7000 ))
431 ("XNet: Random server" XNet "irc.xnet.org" 6667)
432 ("XWorld: Random server" XWorld "irc.xworld.org" 6667)
433 ("ZAnet Net: Random server" ZAnetNet "irc.zanet.net" 6667)
434 ("ZAnet Org: UK, London" ZAnetOrg "mystic.zanet.org.za" 6667)
435 ("ZiRC: Random server" ZiRC "irc.zirc.org" ((6660 6669)))
436 ("ZUHnet: Random server" ZUHnet "irc.zuh.net" 6667)
437 ("Zurna: Random server" Zurna "irc.zurna.net" 6667))
438 "Alist of irc servers. (NAME NET HOST PORTS) where
439NAME is a name for that server,
440NET is a symbol indicating to which network from `erc-networks-alist' this
441 server corresponds,
442HOST is the servers hostname and
443PORTS is either a number, a list of numbers, or a list of port ranges."
444 :group 'erc-networks
445 :type 'sexp)
446
447(defcustom erc-networks-alist
448 '((4-irc "4-irc.com")
449 (A5KNet "a5knet.com")
450 (AbleNet "ablenet.org")
451 (Accessirc "accessirc.net")
452 (Acestar "acestar.org")
453 (Action-IRC "action-irc.net")
454 (AfterNET "afternet.org")
455 (Alternativenet "altnet.org")
456 (AmigaNet "amiganet.org")
457 (AngelEyez "angeleyez.net")
458 (Anothernet "another.net")
459 (ArabChat "arabchat.org")
460 (AsiaTalk "asiatalk.org")
461 (AstroLink "astrolink.org")
462 (Asylumnet "asylumnet.org")
463 (Austnet "austnet.org")
464 (AwesomeChat "awesomechat.net")
465 (Awesomechristians "awesomechristians.com")
466 (Axenet "axenet.org")
467 (Beyondirc "beyondirc.net")
468 (BGIRC "bulgaria.org")
469 (Blabbernet "blabber.net")
470 (Blitzed "blitzed.org")
471 (BrasIRC "brasirc.net")
472 (BRASnet "brasnet.org")
473 (BubbleNet "bubblenet.org")
474 (CCnet "christian-chat.net")
475 (Chat-Net "chat-net.org")
476 (Chat-Solutions "chat-solutions.org")
477 (Chatcafe "chatcafe.net")
478 (Chatchannel "chatchannel.org")
479 (ChatCircuit "chatcircuit.com")
480 (Chatlink "chatlink.org")
481 (Chatnet "chatnet.org")
482 (ChatNut "chatnut.net")
483 (Chatpinoy "chatpinoy.com")
484 (ChatPR "chatpr.org")
485 (Chatroom "chatroom.org")
486 (Chatster "chatster.org")
487 (ChatX "chatx.net")
488 (China263 "263.net")
489 (Cineplex1 "cineplex1.com")
490 (CNN "cnn.com")
491 (CobraNet "cobra.net")
492 (Coolchat "coolchat.net")
493 (Criten "criten.net")
494 (Cyberchat "cyberchat.org")
495 (CyGanet "cyga.net")
496 (DALnet "dal.net")
497 (Dark-Tou-Net "d-t-net.de")
498 (Darkfire "darkfire.net")
499 (DarkMyst "darkmyst.org")
500 (Darkserv "darkserv.net")
501 (Darksystem "darksystem.com")
502 (Darktree "darktree.net")
503 (DayNet "daynet.org")
504 (Deepspace "deepspace.org")
505 (Different "different.net")
506 (Digarix "digarix.net")
507 (Digatech "digatech.net")
508 (Digital-Base "digital-base.net")
509 (Digitalirc "digitalirc.net")
510 (Discussioni "discussioni.org")
511 (DorukNet "doruk.net.tr")
512 (DWChat "dwchat.net")
513 (Dynastynet "dynastynet.net")
514 (EFnet nil)
515 (EgyptianIRC "egyptianirc.net")
516 (Eircnet "eircnet.org")
517 (Eleethal "eleethal.com")
518 (EntertheGame "enterthegame.com")
519 (EpiKnet "epiknet.org")
520 (EsperNet "esper.net")
521 (Esprit "esprit.net")
522 (euIRC "euirc.net")
523 (Evilzinc "evilzinc.net")
524 (ExodusIRC "exodusirc.net")
525 (FDFnet "fdfnet.net")
526 (FEFnet "fef.net")
527 (Financialchat "financialchat.com")
528 (Forestnet "forestnet.org")
529 (ForeverChat "foreverchat.net")
530 (Fraggers "fraggers.co.uk")
531 (FreedomChat "freedomchat.net")
532 (FreedomIRC "freedomirc.net")
533 (freenode "freenode.net")
534 (FunNet "funnet.org")
535 (GalaxyNet "galaxynet.org")
536 (Gamesnet "gamesnet.net")
537 (GammaForce "gammaforce.org")
538 (GIKInet "giki.edu.pk")
539 (GizNet "giznet.org")
540 (Globalchat "globalchat.org")
541 (GlobIRC "globirc.net")
542 (Goldchat "goldchat.nl")
543 (Goodchatting "goodchatting.com")
544 (GravityLords "gravitylords.net")
545 (GRnet "irc.gr")
546 (GulfChat "gulfchat.net")
547 (HabberNet "habber.net")
548 (HanIRC "hanirc.org")
549 (Hellenicnet "mirc.gr")
550 (IceNet "icenet.org.za")
551 (ICQnet "icq.com")
552 (iip "anon.iip")
553 (Infatech "infatech.net")
554 (Infinity "infinity-irc.org")
555 (Infomatrix "infomatrix.net")
556 (Inside3D "inside3d.net")
557 (InterlinkChat "interlinkchat.net")
558 (IRC-Chile "irc.cl")
559 (IRC-Hispano "irc-hispano.org")
560 (IRCchat "ircchat.tk")
561 (IRCGate "ircgate.net")
562 (IRCGeeks "ircgeeks.org")
563 (IRChat "irchat.net")
564 (IrcLordz "irclordz.com")
565 (IrcMalta "ircmalta.org")
566 (IRCnet nil)
567 (IRCSoulZ "ircsoulz.net")
568 (IRCSul "wnet.com.br")
569 (IrcTalk "irctalk.net")
570 (Irctoo "irctoo.net")
571 (IRCtown "irc.irctown.net")
572 (IRCworld "ircworld.org")
573 (ircXtreme "ircXtreme.net")
574 (Israelnet "israel.net")
575 (K0wNet "k0w.net")
576 (KDFSnet "kdfs.net")
577 (Kemik "kemik.net")
578 (Kewl\.Org "kewl.org")
579 (Kickchat "kickchat.com")
580 (KidsWorld "kidsworld.org")
581 (Knightnet "knightnet.net")
582 (Konfido\.Net "konfido.net")
583 (Kreynet "krey.net")
584 (Krono "krono.net")
585 (Krushnet "krushnet.org")
586 (LagNet "lagnet.org.za")
587 (Librenet "librenet.net")
588 (LinkNet "link-net.org")
589 (Liquidized "liquidized.net")
590 (M-IRC "m-sys.org")
591 (MagicStar "magicstar.net")
592 (Mavra "mavra.net")
593 (MediaDriven "mediadriven.com")
594 (mIRC-X "mircx.com")
595 (Morat "morat.net")
596 (MusicCity "musiccity.com")
597 (Mysteria "mysteria.net")
598 (Mysterychat "mysterychat.net")
599 (Mystical "mystical.net")
600 (Narancs "narancs.com")
601 (Net-France "net-france.com")
602 (Nevernet "nevernet.net")
603 (Newnet "newnet.net")
604 (Nexusirc "nexusirc.org")
605 (NightStar "nightstar.net")
606 (NitrousNet "nitrousnet.net")
607 (Novernet "novernet.com")
608 (Nullrouted "nullrouted.org")
609 (NullusNet "nullus.net")
610 (OpChat "opchat.org")
611 (Openprojects "openprojects.net")
612 (Othernet "othernet.org")
613 (OtherSide "othersideirc.net")
614 (Outsiderz "outsiderz.com")
615 (OzOrg "oz.org")
616 (Peacefulhaven "peacefulhaven.net")
617 (PhazedIRC "phazedirc.net")
618 (Philchat "philchat.net")
619 (phrozN "phrozn.net")
620 (PiNet "praetorians.org")
621 (Pinoycentral "abs-cbn.com")
622 (Planetarion "planetarion.com")
623 (POLNet "ircnet.pl")
624 (Psionics "psionics.net")
625 (PTirc "ptirc.com.pt")
626 (PTlink "ptlink.net")
627 (PTnet "ptnet.org")
628 (QChat "qchat.net")
629 (QuakeNet "quakenet.org")
630 (Realirc "realirc.org")
631 (RealmNET "realmnet.com")
632 (Rebelchat "rebelchat.org")
633 (Red-Latina "red-latina.org")
634 (RedLatona "redlatona.net")
635 (Relicnet "relic.net")
636 (Rezosup "rezosup.org")
637 (Risanet "risanet.com")
638 (Rubiks "rubiks.net")
639 (Rusnet "nil")
640 (Sandnet "sandnet.net")
641 (Scunc "scunc.net")
642 (SerbianCafe "serbiancafe.ws")
643 (SexNet "sexnet.org")
644 (ShadowFire "shadowfire.org")
645 (ShadowWorld "shadowworld.net")
646 (SkyNet "bronowski.pl")
647 (SlashNET "slashnet.org")
648 (SolarStone "solarstone.net")
649 (Sorcery "sorcery.net")
650 (SourceIRC "sourceirc.net")
651 (SpaceTronix "spacetronix.net")
652 (Spirit-Harmony "spirit-harmony.com")
653 (StarChat "starchat.net")
654 (StarEquinox "starequinox.net")
655 (Starlink "starlink.net")
656 (starlink-irc "starlink-irc.org")
657 (StarWars-IRC "starwars-irc.net")
658 (Stormdancing "stormdancing.net")
659 (Superchat "superchat.org")
660 (Sysopnet "sysopnet.org")
661 (Telstra "telstra.com")
662 (TR-net "dominet.com.tr")
663 (Tri-net "tri-net.org")
664 (TriLink "ft4u.net")
665 (TurkishChat "turkishchat.org")
666 (UberNinja "uberninja.net")
667 (UICN "uicn.net")
668 (UltraIRC "ultrairc.net")
669 (UnderChat "underchat.it")
670 (Undernet "undernet.org")
671 (UnderZ "underz.org")
672 (UniChat "irc.uni-chat.net")
673 (UnionLatina "unionlatina.org")
674 (Univers "univers.org")
675 (UnixR "unixr.net")
676 (Vidgamechat "vidgamechat.com")
677 (VirtuaNet "virtuanet.org")
678 (Vitamina "vitamina.ca")
679 (Voila "voila.fr")
680 (Wahou "wf-net.org")
681 (Warpednet "warped.net")
682 (Weaklinks "weaklinks.net")
683 (Webnet "webchat.org")
684 (WinChat "winchat.net")
685 (WinIRC "winirc.org")
686 (WorldIRC "worldirc.org")
687 (WyldRyde "wyldryde.net")
688 (XentoniX "xentonix.net")
689 (Xevion "xevion.net")
690 (XNet "xnet.org")
691 (XWorld "xworld.org")
692 (ZAnetNet "zanet.net")
693 (ZAnetOrg "zanet.org.za")
694 (ZiRC "zirc.org")
695 (ZUHnet "zuh.net")
696 (Zurna "zurna.net"))
697 "Alist of IRC networks. (NET MATCHER) where
698NET is a symbol naming that IRC network and
699MATCHER is used to find a corresponding network to a server while connected to
700 it. If it is regexp, it's used to match against `erc-server-announced-name'.
701 It can also be a function (predicate). Then it is executed with the
702 server buffer as current-buffer."
703 :group 'erc-networks
704 :type '(repeat
705 (list :tag "Network"
706 (symbol :tag "Network name")
707 (choice :tag "Network's common server ending"
708 (regexp)
709 (const :tag "Network has no common server ending" nil)))))
710
711(defvar erc-network nil
712 "The name of the network you are connected to (a symbol).")
713(make-variable-buffer-local 'erc-network)
714
715;; Functions:
716
717;;;###autoload
718(defun erc-determine-network ()
719 "Return the name of the network or \"Unknown\" as a symbol. Use the
720server parameter NETWORK if provided, otherwise parse the server name and
721search for a match in `erc-networks-alist'."
722 ;; The server made it easy for us and told us the name of the NETWORK
723 (if (assoc "NETWORK" erc-server-parameters)
724 (intern (cdr (assoc "NETWORK" erc-server-parameters)))
725 (or
726 ;; Loop through `erc-networks-alist' looking for a match.
727 (let ((server (or erc-server-announced-name erc-session-server)))
728 (loop for (name matcher) in erc-networks-alist
729 when (and matcher
730 (string-match (concat matcher "\\'") server))
731 do (return name)))
732 'Unknown)))
733
734(defun erc-network ()
735 "Return the value of `erc-network' for the current server."
736 (with-current-buffer (erc-server-buffer) erc-network))
737
738(defun erc-current-network ()
739 "Deprecated. Use `erc-network' instead. Return the name of this server's
740network as a symbol."
741 (with-current-buffer (erc-server-buffer)
742 (intern (downcase (symbol-name erc-network)))))
743
744(erc-make-obsolete 'erc-current-network 'erc-network
745 "Obsolete since erc-nets 1.5")
746
747(defun erc-network-name ()
748 "Returns the name of the current network as a string."
749 (with-current-buffer (erc-server-buffer) (symbol-name erc-network)))
750
751(defun erc-set-network-name (proc parsed)
752 "Set `erc-network' to the value returned by `erc-determine-network'."
753 (unless erc-server-connected
754 (setq erc-network (erc-determine-network)))
755 nil)
756
757(defun erc-unset-network-name (nick ip reason)
758 "Set `erc-network' to nil."
759 (setq erc-network nil)
760 nil)
761
762(add-hook 'erc-server-375-functions 'erc-set-network-name)
763(add-hook 'erc-server-422-functions 'erc-set-network-name)
764(add-hook 'erc-disconnected-hook 'erc-unset-network-name)
765
766(defun erc-ports-list (ports)
767 "Return a list of PORTS.
768
769PORTS should be a list of either:
770 A number, in which case it is returned a list.
771 Or a pair of the form (LOW HIGH), in which case, a list of all the
772 numbers between LOW and HIGH (inclusive) is returned.
773
774As an example:
775 (erc-ports-list '(1)) => (1)
776 (erc-ports-list '((1 5))) => (1 2 3 4 5)
777 (erc-ports-list '(1 (3 5))) => (1 3 4 5)"
778 (let (result)
779 (dolist (p ports)
780 (cond ((numberp p)
781 (push p result))
782 ((listp p)
783 (setq result (nconc (loop for i from (cadr p) downto (car p)
784 collect i)
785 result)))))
786 (nreverse result)))
787
788;;;###autoload
789(defun erc-server-select ()
790 "Interactively select a server to connect to using `erc-server-alist'."
791 (interactive)
792 (let* ((completion-ignore-case t)
793 (net (intern
794 (completing-read "Network: "
795 (erc-delete-dups
796 (mapcar (lambda (x)
797 (list (symbol-name (nth 1 x))))
798 erc-server-alist)))))
799 (srv (assoc
800 (completing-read "Server: "
801 (delq nil
802 (mapcar (lambda (x)
803 (when (equal (nth 1 x) net)
804 x))
805 erc-server-alist)))
806 erc-server-alist))
807 (host (nth 2 srv))
808 (ports (if (listp (nth 3 srv))
809 (erc-ports-list (nth 3 srv))
810 (list (nth 3 srv))))
811 (port (nth (random (length ports)) ports)))
812 (erc host port erc-nick erc-user-full-name t)))
813
814;;; The following experimental
815;; It does not work yet, help me with it if you
816;; think it is worth the effort.
817
818(defvar erc-settings
819 '((pals freenode ("kensanata" "shapr" "anti\\(fuchs\\|gone\\)"))
820 (format-nick-function (freenode "#emacs") erc-format-@nick))
821 "Experimental: Alist of configuration options.
822The format is (VARNAME SCOPE VALUE) where
823VARNAME is a symbol identifying the configuration option,
824SCOPE is either a symbol which identifies an entry from
825 `erc-networks-alist' or a list (NET TARGET) where NET is a network symbol and
826 TARGET is a string identifying the channel/query target.
827VALUE is the options value.")
828
829(defun erc-get (var &optional net target)
830 (let ((items erc-settings)
831 elt val)
832 (while items
833 (setq elt (car items)
834 items (cdr items))
835 (when (eq (car elt) var)
836 (cond ((and net target (listp (nth 1 elt))
837 (eq net (car (nth 1 elt)))
838 (string-equal target (nth 1 (nth 1 elt))))
839 (setq val (nth 2 elt)
840 items nil))
841 ((and net (eq net (nth 1 elt)))
842 (setq val (nth 2 elt)
843 items nil))
844 ((and (not net) (not target) (not (nth 1 elt)))
845 (setq val (nth 2 elt)
846 items nil)))))
847 val))
848
849(erc-get 'pals 'freenode)
850
851
852(provide 'erc-nets)
853
854;;; erc-nets.el ends here
855;;
856;; Local Variables:
857;; indent-tabs-mode: t
858;; tab-width: 8
859;; End:
860
861;; arch-tag: 68cccabd-f66b-456c-9abe-5f993a2dc91c
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
new file mode 100644
index 00000000000..70ec2f2fc0d
--- /dev/null
+++ b/lisp/erc/erc-netsplit.el
@@ -0,0 +1,212 @@
1;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This module hides quit/join messages if a netsplit occurs.
28;; To enable, add the following to your ~/.emacs:
29;; (require 'erc-netsplit)
30;; (erc-netsplit-mode 1)
31
32;;; Code:
33
34(require 'erc)
35(eval-when-compile (require 'cl))
36
37(defgroup erc-netsplit nil
38 "Netsplit detection tries to automatically figure when a
39netsplit happens, and filters the QUIT messages. It also keeps
40track of netsplits, so that it can filter the JOIN messages on a netjoin too."
41 :group 'erc)
42
43;;;###autoload (autoload 'erc-netsplit-mode "erc-netsplit")
44(define-erc-module netsplit nil
45 "This mode hides quit/join messages if a netsplit occurs."
46 ((erc-netsplit-install-message-catalogs)
47 (add-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN)
48 (add-hook 'erc-server-MODE-functions 'erc-netsplit-MODE)
49 (add-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT)
50 (add-hook 'erc-timer-hook 'erc-netsplit-timer))
51 ((remove-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN)
52 (remove-hook 'erc-server-MODE-functions 'erc-netsplit-MODE)
53 (remove-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT)
54 (remove-hook 'erc-timer-hook 'erc-netsplit-timer)))
55
56(defcustom erc-netsplit-show-server-mode-changes-flag nil
57 "Set to t to enable display of server mode changes."
58 :group 'erc-netsplit
59 :type 'boolean)
60
61(defcustom erc-netsplit-debug nil
62 "If non-nil, debug messages will be shown in the
63sever buffer."
64 :group 'erc-netsplit
65 :type 'boolean)
66
67(defcustom erc-netsplit-regexp "^[^ @!\"]+\\.[^ @!]+ [^ @!]+\\.[^ @!\"]+$"
68 "This regular expression should match quit reasons produced
69by netsplits."
70 :group 'erc-netsplit
71 :type 'regexp)
72
73(defcustom erc-netsplit-hook nil
74 "Run whenever a netsplit is detected the first time.
75Args: PROC is the process the netsplit originated from and
76 SPLIT is the netsplit (e.g. \"server.name.1 server.name.2\")."
77 :group 'erc-hooks
78 :type 'hook)
79
80(defcustom erc-netjoin-hook nil
81 "Run whenever a netjoin is detected the first time.
82Args: PROC is the process the netjoin originated from and
83 SPLIT is the netsplit (e.g. \"server.name.1 server.name.2\")."
84 :group 'erc-hooks
85 :type 'hook)
86
87(defvar erc-netsplit-list nil
88 "This is a list of the form
89\((\"a.b.c.d e.f.g\" TIMESTAMP FIRST-JOIN \"nick1\" ... \"nickn\") ...)
90where FIRST-JOIN is t or nil, depending on whether or not the first
91join from that split has been detected or not.")
92(make-variable-buffer-local 'erc-netsplit-list)
93
94(defun erc-netsplit-install-message-catalogs ()
95 (erc-define-catalog
96 'english
97 '((netsplit . "netsplit: %s")
98 (netjoin . "netjoin: %s, %N were split")
99 (netjoin-done . "netjoin: All lost souls are back!")
100 (netsplit-none . "No netsplits in progress")
101 (netsplit-wholeft . "split: %s missing: %n %t"))))
102
103(defun erc-netsplit-JOIN (proc parsed)
104 "Show/don't show rejoins."
105 (let ((nick (erc-response.sender parsed))
106 (no-next-hook nil))
107 (dolist (elt erc-netsplit-list)
108 (if (member nick (nthcdr 3 elt))
109 (progn
110 (if (not (caddr elt))
111 (progn
112 (erc-display-message
113 parsed 'notice (process-buffer proc)
114 'netjoin ?s (car elt) ?N (length (nthcdr 3 elt)))
115 (setcar (nthcdr 2 elt) t)
116 (run-hook-with-args 'erc-netjoin-hook proc (car elt))))
117 ;; need to remove this nick, perhaps the whole entry here.
118 ;; Note that by removing the nick now, we can't tell if further
119 ;; join messages (for other channels) should also be
120 ;; suppressed.
121 (if (null (nthcdr 4 elt))
122 (progn
123 (erc-display-message
124 parsed 'notice (process-buffer proc)
125 'netjoin-done ?s (car elt))
126 (setq erc-netsplit-list (delq elt erc-netsplit-list)))
127 (delete nick elt))
128 (setq no-next-hook t))))
129 no-next-hook))
130
131(defun erc-netsplit-MODE (proc parsed)
132 "Hide mode changes from servers."
133 ;; regexp matches things with a . in them, and no ! or @ in them.
134 (when (string-match "^[^@!]+\\.[^@!]+$" (erc-response.sender parsed))
135 (and erc-netsplit-debug
136 (erc-display-message
137 parsed 'notice (process-buffer proc)
138 "[debug] server mode change."))
139 (not erc-netsplit-show-server-mode-changes-flag)))
140
141(defun erc-netsplit-QUIT (proc parsed)
142 "Detect netsplits."
143 (let ((split (erc-response.contents parsed))
144 (nick (erc-response.sender parsed))
145 ass)
146 (when (string-match erc-netsplit-regexp split)
147 (setq ass (assoc split erc-netsplit-list))
148 (if ass
149 ;; element for this netsplit exists already
150 (progn
151 (setcdr (nthcdr 2 ass) (cons nick (nthcdr 3 ass)))
152 (when (caddr ass)
153 ;; There was already a netjoin for this netsplit, it
154 ;; seems like the old one didn't get finished...
155 (erc-display-message
156 parsed 'notice (process-buffer proc)
157 'netsplit ?s split)
158 (setcar (nthcdr 2 ass) t)
159 (run-hook-with-args 'erc-netsplit-hook proc split)))
160 ;; element for this netsplit does not yet exist
161 (setq erc-netsplit-list
162 (cons (list split
163 (erc-current-time)
164 nil
165 nick)
166 erc-netsplit-list))
167 (erc-display-message
168 parsed 'notice (process-buffer proc)
169 'netsplit ?s split)
170 (run-hook-with-args 'erc-netsplit-hook proc split))
171 t)))
172
173(defun erc-netsplit-timer (now)
174 "Clean cruft from `erc-netsplit-list' older than 10 minutes."
175 (dolist (elt erc-netsplit-list)
176 (when (> (erc-time-diff (cadr elt) now) 600)
177 (when erc-netsplit-debug
178 (erc-display-message
179 nil 'notice (current-buffer)
180 (concat "Netsplit: Removing " (car elt))))
181 (setq erc-netsplit-list (delq elt erc-netsplit-list)))))
182
183;;;###autoload
184(defun erc-cmd-WHOLEFT ()
185 "Show who's gone."
186 (with-current-buffer (erc-server-buffer)
187 (if (null erc-netsplit-list)
188 (erc-display-message
189 nil 'notice 'active
190 'netsplit-none)
191 (dolist (elt erc-netsplit-list)
192 (erc-display-message
193 nil 'notice 'active
194 'netsplit-wholeft ?s (car elt)
195 ?n (mapconcat 'erc-extract-nick (nthcdr 3 elt) " ")
196 ?t (if (caddr elt)
197 "(joining)"
198 "")))))
199 t)
200
201(defalias 'erc-cmd-WL 'erc-cmd-WHOLEFT)
202
203(provide 'erc-netsplit)
204
205;;; erc-netsplit.el ends here
206;;
207;; Local Variables:
208;; indent-tabs-mode: t
209;; tab-width: 8
210;; End:
211
212;; arch-tag: 61a85cb0-7e7b-4312-a4f6-313c7a25a6e8
diff --git a/lisp/erc/erc-nicklist.el b/lisp/erc/erc-nicklist.el
new file mode 100644
index 00000000000..5599565844b
--- /dev/null
+++ b/lisp/erc/erc-nicklist.el
@@ -0,0 +1,411 @@
1;;; erc-nicklist.el --- Display channel nicknames in a side buffer.
2
3;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
4
5;; Filename: erc-nicklist.el
6;; Author: Lawrence Mitchell <wence@gmx.li>
7;; Created: 2004-04-30
8;; Keywords: IRC chat client Internet
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28;;
29;; This provides a minimal mIRC style nicklist buffer for ERC. To
30;; activate, do M-x erc-nicklist RET in the channel buffer you want
31;; the nicklist to appear for. To close and quit the nicklist
32;; buffer, do M-x erc-nicklist-quit RET.
33;;
34;; TODO:
35;; o Somehow associate nicklist windows with channel windows so they
36;; appear together, and if one gets buried, then the other does.
37;;
38;; o Make "Query" and "Message" work.
39;;
40;; o Prettify the actual list of nicks in some way.
41;;
42;; o Add a proper erc-module that people can turn on and off, figure
43;; out a way of creating the nicklist window at an appropriate time
44;; --- probably in `erc-join-hook'.
45;;
46;; o Ensure XEmacs compatibility --- the mouse-menu support is likely
47;; broken.
48;;
49;; o Add option to display in a separate frame --- will again need to
50;; be able to associate the nicklist with the currently active
51;; channel buffer or something similar.
52;;
53;; o Allow toggling of visibility of nicklist via ERC commands.
54
55;;; History:
56;;
57
58;; Changes by Edgar Gonçalves <edgar.goncalves@inesc-id.pt>
59;; Jun 25 2005:
60;; - images are changed to a standard set of names.
61;; - /images now contain gaim's status icons.
62;; May 31 2005:
63;; - tooltips are improved. they try to access bbdb for a nice nick!
64;; Apr 26 2005:
65;; - erc-nicklist-channel-users-info was fixed (sorting bug)
66;; - Away names don't need parenthesis when using icons
67;; Apr 26 2005:
68;; - nicks can display icons of their connection type (msn, icq, for now)
69;; Mar 15 2005:
70;; - nicks now are different for unvoiced and op users
71;; - nicks now have tooltips displaying more info
72;; Mar 18 2005:
73;; - queries now work ok, both on menu and keyb shortcut RET.
74;; - nicklist is now sorted ignoring the case. Voiced nicks will
75;; appear according to `erc-nicklist-voiced-position'.
76
77;;; Code:
78
79(require 'erc)
80(condition-case nil
81 (require 'erc-bbdb)
82 (error nil))
83(eval-when-compile (require 'cl))
84
85(defgroup erc-nicklist nil
86 "Display a list of nicknames in a separate window."
87 :group 'erc)
88
89(defcustom erc-nicklist-use-icons t
90 "*If non-nil, display an icon instead of the name of the chat medium.
91By \"chat medium\", we mean IRC, AOL, MSN, ICQ, etc."
92 :group 'erc-nicklist
93 :type 'boolean)
94
95(defcustom erc-nicklist-icons-directory
96 (concat default-directory "images/")
97 "*Directory of the PNG files for chat icons.
98Icons are displayed if `erc-nicklist-use-icons' is non-nil."
99 :group 'erc-nicklist
100 :type 'string)
101
102(defcustom erc-nicklist-voiced-position 'bottom
103 "*Position of voiced nicks in the nicklist.
104The value can be `top', `bottom' or nil (don't sort)."
105 :group 'erc-nicklist
106 :type '(choice
107 (const :tag "Top" 'top)
108 (const :tag "Bottom" 'bottom)
109 (const :tag "Mixed" nil)))
110
111(defcustom erc-nicklist-window-size 20.0
112 "*The size of the nicklist window.
113
114This specifies a percentage of the channel window width.
115
116A negative value means the nicklist window appears on the left of the
117channel window, and vice versa."
118 :group 'erc-nicklist
119 :type 'float)
120
121
122(defun erc-nicklist-buffer-name (&optional buffer)
123 "Return the buffer name for a nicklist associated with BUFFER.
124
125If BUFFER is nil, use the value of `current-buffer'."
126 (format " *%s-nicklist*" (buffer-name (or buffer (current-buffer)))))
127
128(defun erc-nicklist-make-window ()
129 "Create an ERC nicklist window.
130
131See also `erc-nicklist-window-size'."
132 (let ((width (floor (* (window-width) (/ erc-nicklist-window-size 100.0))))
133 (buffer (erc-nicklist-buffer-name))
134 window)
135 (split-window-horizontally (- width))
136 (setq window (next-window))
137 (set-window-buffer window (get-buffer-create buffer))
138 (with-current-buffer buffer
139 (set-window-dedicated-p window t))))
140
141
142(defvar erc-nicklist-images-alist '()
143 "Alist that maps a connection type to an icon.")
144
145(defun erc-nicklist-insert-medium-name-or-icon (host channel is-away)
146 "Inserts an icon or a string identifying the current host type.
147This is configured using `erc-nicklist-use-icons' and
148`erc-nicklist-icons-directory'."
149 ;; identify the network (for bitlebee usage):
150 (let ((bitlbee-p (save-match-data
151 (string-match "\\`&bitlbee\\b"
152 (buffer-name channel)))))
153 (cond ((and bitlbee-p
154 (string= "login.icq.com" host))
155 (if erc-nicklist-use-icons
156 (if is-away
157 (insert-image (cdr (assoc 'icq-away
158 erc-nicklist-images-alist)))
159 (insert-image (cdr (assoc 'icq
160 erc-nicklist-images-alist))))
161 (insert "ICQ")))
162 (bitlbee-p
163 (if erc-nicklist-use-icons
164 (if is-away
165 (insert-image (cdr (assoc 'msn-away
166 erc-nicklist-images-alist)))
167 (insert-image (cdr (assoc 'msn
168 erc-nicklist-images-alist))))
169 (insert "MSN")))
170 (t
171 (if erc-nicklist-use-icons
172 (if is-away
173 (insert-image (cdr (assoc 'irc-away
174 erc-nicklist-images-alist)))
175 (insert-image (cdr (assoc 'irc
176 erc-nicklist-images-alist))))
177 (insert "IRC"))))
178 (insert " ")))
179
180(defun erc-nicklist-search-for-nick (finger-host)
181 "Return the bitlbee-nick field for this contact given FINGER-HOST.
182Seach for the BBDB record of this contact. If not found, return nil."
183 (when (boundp 'erc-bbdb-bitlbee-name-field)
184 (let ((record (car
185 (erc-member-if
186 #'(lambda (r)
187 (let ((fingers (bbdb-record-finger-host r)))
188 (when fingers
189 (string-match finger-host
190 (car (bbdb-record-finger-host r))))))
191 (bbdb-records)))))
192 (when record
193 (bbdb-get-field record erc-bbdb-bitlbee-name-field)))))
194
195(defun erc-nicklist-insert-contents (channel)
196 "Insert the nicklist contents, with text properties and the optional images."
197 (setq buffer-read-only nil)
198 (erase-buffer)
199 (dolist (u (erc-nicklist-channel-users-info channel))
200 (let* ((server-user (car u))
201 (channel-user (cdr u))
202 (nick (erc-server-user-nickname server-user))
203 (host (erc-server-user-host server-user))
204 (login (erc-server-user-login server-user))
205 (full-name(erc-server-user-full-name server-user))
206 (info (erc-server-user-info server-user))
207 (channels (erc-server-user-buffers server-user))
208 (op (erc-channel-user-op channel-user))
209 (voice (erc-channel-user-voice channel-user))
210 (bbdb-nick (erc-nicklist-search-for-nick (concat login "@" host)))
211 (away-status (if voice "" "\n(Away)"))
212 (balloon-text (concat bbdb-nick (if (string= "" bbdb-nick)
213 "" "\n")
214 "Login: " login "@" host
215 away-status)))
216 (erc-nicklist-insert-medium-name-or-icon host channel (not voice))
217 (unless (or voice erc-nicklist-use-icons)
218 (setq nick (concat "(" nick ")")))
219 (when op
220 (setq nick (concat nick " (OP)")))
221 (insert (erc-propertize nick
222 'erc-nicklist-nick nick
223 'mouse-face 'highlight
224 'erc-nicklist-channel channel
225 'help-echo balloon-text)
226 "\n")))
227 (erc-nicklist-mode))
228
229
230(defun erc-nicklist ()
231 "Create an ERC nicklist buffer."
232 (interactive)
233 (let ((channel (current-buffer)))
234 (unless (or (not erc-nicklist-use-icons)
235 erc-nicklist-images-alist)
236 (setq erc-nicklist-images-alist
237 `((msn . ,(create-image (concat erc-nicklist-icons-directory
238 "msn-online.png")))
239 (msn-away . ,(create-image (concat erc-nicklist-icons-directory
240 "msn-offline.png")))
241 (irc . ,(create-image (concat erc-nicklist-icons-directory
242 "irc-online.png")))
243 (irc-away . ,(create-image (concat erc-nicklist-icons-directory
244 "irc-offline.png")))
245 (icq . ,(create-image (concat erc-nicklist-icons-directory
246 "icq-online.png")))
247 (icq-away . ,(create-image (concat erc-nicklist-icons-directory
248 "icq-offline.png"))))))
249 (erc-nicklist-make-window)
250 (with-current-buffer (get-buffer (erc-nicklist-buffer-name channel))
251 (erc-nicklist-insert-contents channel)))
252 (add-hook 'erc-channel-members-changed-hook #'erc-nicklist-update))
253
254(defun erc-nicklist-update ()
255 "Update the ERC nicklist buffer."
256 (let ((b (get-buffer (erc-nicklist-buffer-name)))
257 (channel (current-buffer)))
258 (when b
259 (with-current-buffer b
260 (erc-nicklist-insert-contents channel)))))
261
262(defvar erc-nicklist-mode-map
263 (let ((map (make-sparse-keymap)))
264 (define-key map (kbd "<down-mouse-3>") 'erc-nicklist-menu)
265 (define-key map "\C-j" 'erc-nicklist-kbd-menu)
266 (define-key map "q" 'erc-nicklist-quit)
267 (define-key map (kbd "RET") 'erc-nicklist-kbd-cmd-QUERY)
268 map)
269 "Keymap for `erc-nicklist-mode'.")
270
271(define-derived-mode erc-nicklist-mode fundamental-mode
272 "Nicklist"
273 "Major mode for the ERC nicklist buffer."
274 (setq buffer-read-only t))
275
276(defun erc-nicklist-call-erc-command (command point buffer window)
277 "Call an ERC COMMAND.
278
279Depending on what COMMAND is, it's called with one of POINT, BUFFER,
280or WINDOW as arguments."
281 (when command
282 (let* ((p (text-properties-at point))
283 (b (plist-get p 'erc-nicklist-channel)))
284 (if (memq command '(erc-nicklist-quit ignore))
285 (funcall command window)
286 ;; EEEK! Horrble, but it's the only way we can ensure the
287 ;; response goes to the correct buffer.
288 (erc-set-active-buffer b)
289 (switch-to-buffer-other-window b)
290 (funcall command (plist-get p 'erc-nicklist-nick))))))
291
292(defun erc-nicklist-cmd-QUERY (user &optional server)
293 "Opens a query buffer with USER."
294 ;; FIXME: find a way to switch to that buffer afterwards...
295 (let ((send (if server
296 (format "QUERY %s %s" user server)
297 (format "QUERY %s" user))))
298 (erc-cmd-QUERY user)
299 t))
300
301(defun erc-nicklist-kbd-cmd-QUERY (&optional window)
302 (interactive)
303 (let* ((p (text-properties-at (point)))
304 (server (plist-get p 'erc-nicklist-channel))
305 (nick (plist-get p 'erc-nicklist-nick))
306 (nick (or (and (string-match "(\\(.*\\))" nick)
307 (match-string 1 nick))
308 nick))
309 (nick (or (and (string-match "\\+\\(.*\\)" nick)
310 (match-string 1 nick))
311 nick))
312 (send (format "QUERY %s %s" nick server)))
313 (switch-to-buffer-other-window server)
314 (erc-cmd-QUERY nick)))
315
316
317(defvar erc-nicklist-menu
318 (let ((map (make-sparse-keymap "Action")))
319 (define-key map [erc-cmd-WHOIS]
320 '("Whois" . erc-cmd-WHOIS))
321 (define-key map [erc-cmd-DEOP]
322 '("Deop" . erc-cmd-DEOP))
323 (define-key map [erc-cmd-MSG]
324 '("Message" . erc-cmd-MSG)) ;; TODO!
325 (define-key map [erc-nicklist-cmd-QUERY]
326 '("Query" . erc-nicklist-kbd-cmd-QUERY))
327 (define-key map [ignore]
328 '("Cancel" . ignore))
329 (define-key map [erc-nicklist-quit]
330 '("Close nicklist" . erc-nicklist-quit))
331 map)
332 "Menu keymap for the ERC nicklist.")
333
334(defun erc-nicklist-quit (&optional window)
335 "Delete the ERC nicklist.
336
337Deletes WINDOW and stops updating the nicklist buffer."
338 (interactive)
339 (let ((b (window-buffer window)))
340 (with-current-buffer b
341 (set-buffer-modified-p nil)
342 (kill-this-buffer)
343 (remove-hook 'erc-channel-members-changed-hook 'erc-nicklist-update))))
344
345
346(defun erc-nicklist-kbd-menu ()
347 "Show the ERC nicklist menu."
348 (interactive)
349 (let* ((point (point))
350 (window (selected-window))
351 (buffer (current-buffer)))
352 (with-current-buffer buffer
353 (erc-nicklist-call-erc-command
354 (car (x-popup-menu point
355 erc-nicklist-menu))
356 point
357 buffer
358 window))))
359
360(defun erc-nicklist-menu (&optional arg)
361 "Show the ERC nicklist menu.
362
363ARG is a parametrized event (see `interactive')."
364 (interactive "e")
365 (let* ((point (nth 1 (cadr arg)))
366 (window (car (cadr arg)))
367 (buffer (window-buffer window)))
368 (with-current-buffer buffer
369 (erc-nicklist-call-erc-command
370 (car (x-popup-menu arg
371 erc-nicklist-menu))
372 point
373 buffer
374 window))))
375
376
377(defun erc-nicklist-channel-users-info (channel)
378 "Return a nick-sorted list of all users on CHANNEL.
379Result are elements in the form (SERVER-USER . CHANNEL-USER). The
380list has all the voiced users according to
381`erc-nicklist-voiced-position'."
382 (let* ((nicks (erc-sort-channel-users-alphabetically
383 (with-current-buffer channel (erc-get-channel-user-list)))))
384 (if erc-nicklist-voiced-position
385 (let ((voiced-nicks (erc-remove-if-not
386 #'(lambda (x)
387 (null (erc-channel-user-voice (cdr x))))
388 nicks))
389 (devoiced-nicks (erc-remove-if-not
390 #'(lambda (x)
391 (erc-channel-user-voice
392 (cdr x)))
393 nicks)))
394 (cond ((eq erc-nicklist-voiced-position 'top)
395 (append devoiced-nicks voiced-nicks))
396 ((eq erc-nicklist-voiced-position 'bottom)
397 (append voiced-nicks devoiced-nicks))))
398 nicks)))
399
400
401
402(provide 'erc-nicklist)
403
404;;; erc-nicklist.el ends here
405;;
406;; Local Variables:
407;; indent-tabs-mode: t
408;; tab-width: 8
409;; End:
410
411;; arch-tag: db37a256-87a7-4544-bd90-e5f16c9f5ca5
diff --git a/lisp/erc/erc-nickserv.el b/lisp/erc/erc-nickserv.el
new file mode 100644
index 00000000000..be5541d3b5c
--- /dev/null
+++ b/lisp/erc/erc-nickserv.el
@@ -0,0 +1,337 @@
1;;; erc-nickserv.el --- Identify to NickServ
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs; see the file COPYING. If not, write to the
19;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20;; Boston, MA 02110-1301, USA.
21
22;;; Commentary:
23
24;; There are two ways to go about identifying yourself automatically to
25;; NickServ with this module. The more secure way is to listen for identify
26;; requests from the user NickServ. Another way is to identify yourself to
27;; NickServ directly after a successful connection and every time you change
28;; your nickname. This method is rather insecure, though, because no checks
29;; are made to test if NickServ is the real NickServ for a given network or
30;; server.
31
32;; As a default, ERC has the data for the official nickname services on the
33;; networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, and Slashnet.
34;; You can add more by using M-x customize-variable RET erc-nickserv-alist.
35
36;; Usage:
37;;
38;; Put into your .emacs:
39;;
40;; (require 'erc-nickserv)
41;; (erc-services-mode 1)
42;;
43;; Add your nickname and NickServ password to `erc-nickserv-passwords'.
44;; Using the freenode network as an example:
45;;
46;; (setq erc-nickserv-passwords '((freenode (("nickname" "password")))))
47;;
48;; The default automatic identification mode is autodetection of NickServ
49;; identify requests. Set the variable `erc-nickserv-identify-mode' if
50;; you'd like to change this behavior. You can also change the way
51;; automatic identification is handled by using:
52;;
53;; M-x erc-nickserv-identify-mode
54;;
55;; If you'd rather not identify yourself automatically but would like access
56;; to the functions contained in this file, just load this file without
57;; enabling `erc-services-mode'.
58;;
59
60;;; Code:
61
62(require 'erc)
63(require 'erc-nets)
64(eval-when-compile (require 'cl))
65
66;; Customization:
67
68(defgroup erc-services nil
69 "Configuration for IRC services.
70
71On some networks, there exists a special type of automated irc bot,
72called Services. Those usually allow you to register your nickname,
73post/read memos to other registered users who are currently offline,
74and do various other things.
75
76This group allows you to set variables to somewhat automate
77communication with those Services."
78 :group 'erc)
79
80;;;###autoload (autoload 'erc-services-mode "erc-nickserv" nil t)
81(define-erc-module services nickserv
82 "This mode automates communication with services."
83 ((erc-nickserv-identify-mode erc-nickserv-identify-mode))
84 ((remove-hook 'erc-server-NOTICE-functions
85 'erc-nickserv-identify-autodetect)
86 (remove-hook 'erc-after-connect
87 'erc-nickserv-identify-on-connect)
88 (remove-hook 'erc-nick-changed-functions
89 'erc-nickserv-identify-on-nick-change)))
90
91;;;###autoload
92(defun erc-nickserv-identify-mode (mode)
93 "Set up hooks according to which MODE the user has chosen."
94 (interactive
95 (list (intern (completing-read
96 "Choose Nickserv identify mode (RET to disable): "
97 '(("autodetect") ("nick-change")) nil t))))
98 (cond ((eq mode 'autodetect)
99 (setq erc-nickserv-identify-mode 'autodetect)
100 (add-hook 'erc-server-NOTICE-functions
101 'erc-nickserv-identify-autodetect)
102 (remove-hook 'erc-nick-changed-functions
103 'erc-nickserv-identify-on-nick-change)
104 (remove-hook 'erc-after-connect
105 'erc-nickserv-identify-on-connect))
106 ((eq mode 'nick-change)
107 (setq erc-nickserv-identify-mode 'nick-change)
108 (add-hook 'erc-after-connect
109 'erc-nickserv-identify-on-connect)
110 (add-hook 'erc-nick-changed-functions
111 'erc-nickserv-identify-on-nick-change)
112 (remove-hook 'erc-server-NOTICE-functions
113 'erc-nickserv-identify-autodetect))
114 (t
115 (setq erc-nickserv-identify-mode nil)
116 (remove-hook 'erc-server-NOTICE-functions
117 'erc-nickserv-identify-autodetect)
118 (remove-hook 'erc-after-connect
119 'erc-nickserv-identify-on-connect)
120 (remove-hook 'erc-nick-changed-functions
121 'erc-nickserv-identify-on-nick-change))))
122
123(defcustom erc-nickserv-identify-mode 'autodetect
124 "The mode which is used when identifying to Nickserv.
125
126Possible settings are:.
127
128'autodetect - Identify when the real Nickserv sends an identify request.
129'nick-change - Identify when you change your nickname.
130nil - Disables automatic Nickserv identification.
131
132You can also use M-x erc-nickserv-identify-mode to change modes."
133 :group 'erc-services
134 :type '(choice (const autodetect)
135 (const nick-change)
136 (const nil))
137 :set (lambda (sym val)
138 (set-default sym val)
139 (erc-nickserv-identify-mode val)))
140
141(defcustom erc-prompt-for-nickserv-password t
142 "Ask for the password when identifying to NickServ."
143 :group 'erc-services
144 :type 'boolean)
145
146(defcustom erc-nickserv-passwords nil
147 "Passwords used when identifying to NickServ automatically.
148
149Example of use:
150 (setq erc-nickserv-passwords
151 '((freenode ((\"nick-one\" . \"password\")
152 (\"nick-two\" . \"password\")))
153 (DALnet ((\"nick\" . \"password\")))))"
154 :group 'erc-services
155 :type '(repeat
156 (list :tag "Network"
157 (choice :tag "Network name"
158 (const freenode)
159 (const DALnet)
160 (const GalaxyNet)
161 (const SlashNET)
162 (const BRASnet)
163 (const iip)
164 (const Austnet)
165 (symbol :tag "Network name"))
166 (repeat :tag "Nickname and password"
167 (cons :tag "Identity"
168 (string :tag "Nick")
169 (string :tag "Password"))))))
170
171;; Variables:
172
173(defcustom erc-nickserv-alist
174 '((DALnet
175 "NickServ!service@dal.net"
176 "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>"
177 "NickServ@services.dal.net"
178 "IDENTIFY"
179 nil)
180 (freenode
181 "NickServ!NickServ@services."
182 "/msg\\s-NickServ\\s-IDENTIFY\\s-<password>"
183 "NickServ"
184 "IDENTIFY"
185 nil)
186 (GalaxyNet
187 "NS!nickserv@galaxynet.org"
188 "Please\\s-change\\s-nicks\\s-or\\s-authenticate."
189 "NS@services.galaxynet.org"
190 "AUTH"
191 t)
192 (SlashNET
193 "NickServ!services@services.slashnet.org"
194 "/msg\\s-NickServ\\s-IDENTIFY\\s-password"
195 "NickServ@services.slashnet.org"
196 "IDENTIFY"
197 nil)
198 (iip
199 "Trent@anon.iip"
200 "type\\s-/squery\\s-Trent\\s-identify\\s-<password>"
201 "Trent@anon.iip"
202 "IDENTIFY"
203 nil
204 "SQUERY")
205 (BRASnet
206 "NickServ!services@brasnet.org"
207 "/NickServ\\s-IDENTIFY\\s-senha"
208 "NickServ"
209 "IDENTIFY"
210 nil
211 "")
212 (Austnet
213 "NickOP!service@austnet.org"
214 "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
215 "nickop@austnet.org"
216 "identify"
217 nil)
218 (Azzurra
219 "NickServ!service@azzurra.org"
220 "/ns\\s-IDENTIFY\\s-password"
221 "NickServ"
222 "IDENTIFY"
223 nil)
224 (OFTC
225 "NickServ!services@services.oftc.net"
226 "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
227 "NickServ"
228 "IDENTIFY"
229 nil))
230 "Alist of NickServer details, sorted by network.
231Every element in the list has the form
232 \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
233
234SYMBOL is a network identifier, a symbol, as used in `erc-networks-alist'.
235NICKSERV is the description of the nickserv in the form nick!user@host.
236REGEXP is a regular expression matching the message from nickserv.
237NICK is nickserv's nickname. Use nick@server where necessary/possible.
238KEYWORD is the keyword to use in the reply message to identify yourself.
239USE-CURRENT indicates whether the current nickname must be used when
240 identifying.
241ANSWER is the command to use for the answer. The default is 'privmsg.
242 This last element is optional."
243 :group 'erc-services
244 :type '(repeat
245 (list :tag "Nickserv data"
246 (symbol :tag "Network name")
247 (string :tag "Nickserv's nick!user@host")
248 (regexp :tag "Identify request sent by Nickserv")
249 (string :tag "Identify to")
250 (string :tag "Identify keyword")
251 (boolean :tag "Use current nick in identify message?")
252 (choice :tag "Command to use (optional)"
253 (string :tag "Command")
254 (const :tag "No special command necessary" nil)))))
255
256;; Functions:
257
258(defun erc-nickserv-identify-autodetect (proc parsed)
259 "Check for a NickServ identify request everytime a notice is received.
260Make sure it is the real NickServ for this network and that it has
261specifically asked the user to IDENTIFY.
262If `erc-prompt-for-nickserv-password' is non-nil, prompt the user for the
263password for this nickname, otherwise try to send it automatically."
264 (unless (and (null erc-nickserv-passwords)
265 (null erc-prompt-for-nickserv-password))
266 (let* ((network (erc-network))
267 (nickserv (nth 1 (assoc network erc-nickserv-alist)))
268 (identify-regex (nth 2 (assoc network erc-nickserv-alist)))
269 (sspec (erc-response.sender parsed))
270 (nick (car (erc-response.command-args parsed)))
271 (msg (erc-response.contents parsed)))
272 ;; continue only if we're sure it's the real nickserv for this network
273 ;; and it's asked us to identify
274 (when (and nickserv (equal sspec nickserv)
275 (string-match identify-regex msg))
276 (erc-log "NickServ IDENTIFY request detected")
277 (erc-nickserv-call-identify-function nick)
278 nil))))
279
280(defun erc-nickserv-identify-on-connect (server nick)
281 "Identify to Nickserv after the connection to the server is established."
282 (unless (and (null erc-nickserv-passwords)
283 (null erc-prompt-for-nickserv-password))
284 (erc-nickserv-call-identify-function nick)))
285
286(defun erc-nickserv-identify-on-nick-change (nick old-nick)
287 "Identify to Nickserv whenever your nick changes."
288 (unless (and (null erc-nickserv-passwords)
289 (null erc-prompt-for-nickserv-password))
290 (erc-nickserv-call-identify-function nick)))
291
292(defun erc-nickserv-call-identify-function (nickname)
293 "Call `erc-nickserv-identify' interactively or run it with NICKNAME's
294password.
295The action is determined by the value of `erc-prompt-for-nickserv-password'."
296 (if erc-prompt-for-nickserv-password
297 (call-interactively 'erc-nickserv-identify)
298 (when erc-nickserv-passwords
299 (erc-nickserv-identify
300 (cdr (assoc nickname
301 (nth 1 (assoc (erc-network)
302 erc-nickserv-passwords))))))))
303
304;;;###autoload
305(defun erc-nickserv-identify (password)
306 "Send an \"identify <PASSWORD>\" message to NickServ.
307When called interactively, read the password using `read-passwd'."
308 (interactive
309 (list (read-passwd
310 (format "NickServ password for %s on %s (RET to cancel): "
311 (erc-current-nick)
312 (or (and (erc-network)
313 (symbol-name (erc-network)))
314 "Unknown network")))))
315 (when (and password (not (string= "" password)))
316 (let* ((erc-auto-discard-away nil)
317 (network (erc-network))
318 (nickserv-info (assoc network erc-nickserv-alist))
319 (nickserv (or (nth 3 nickserv-info) "NickServ"))
320 (identify-word (or (nth 4 nickserv-info) "IDENTIFY"))
321 (nick (if (nth 5 nickserv-info)
322 (concat (erc-current-nick) " ")
323 ""))
324 (msgtype (or (nth 6 nickserv-info) "PRIVMSG")))
325 (erc-message msgtype
326 (concat nickserv " " identify-word " " nick password)))))
327
328(provide 'erc-nickserv)
329
330;;; erc-nickserv.el ends here
331;;
332;; Local Variables:
333;; indent-tabs-mode: t
334;; tab-width: 8
335;; End:
336
337;; arch-tag: d401c8aa-d938-4255-96a9-3efb64c47e58
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
new file mode 100644
index 00000000000..9fc7f572977
--- /dev/null
+++ b/lisp/erc/erc-notify.el
@@ -0,0 +1,254 @@
1;;; erc-notify.el --- Online status change notification
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@lexx.delysid.org>
6;; Keywords: comm
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This module defines a new command, /NOTIFY
28;; See the docstring of `erc-cmd-NOTIFY' for details.
29
30;;; Code:
31
32(require 'erc)
33(require 'erc-nets)
34(eval-when-compile
35 (require 'cl)
36 (require 'pcomplete))
37
38;;;; Customizable variables
39
40(defgroup erc-notify nil
41 "Track online status of certain nicknames."
42 :group 'erc)
43
44(defcustom erc-notify-list nil
45 "*List of nicknames you want to be notified about online/offline
46status change."
47 :group 'erc-notify
48 :type '(repeat string))
49
50(defcustom erc-notify-interval 60
51 "*Time interval (in seconds) for checking online status of notificated
52people."
53 :group 'erc-notify
54 :type 'integer)
55
56(defcustom erc-notify-signon-hook nil
57 "*Hook run after someone on `erc-notify-list' has signed on.
58Two arguments are passed to the function, SERVER and NICK, both
59strings."
60 :group 'erc-notify
61 :type 'hook
62 :options '(erc-notify-signon))
63
64(defcustom erc-notify-signoff-hook nil
65 "*Hook run after someone on `erc-notify-list' has signed off.
66Two arguments are passed to the function, SERVER and NICK, both
67strings."
68 :group 'erc-notify
69 :type 'hook
70 :options '(erc-notify-signoff))
71
72(defun erc-notify-signon (server nick)
73 (message "%s signed on at %s" nick server))
74
75(defun erc-notify-signoff (server nick)
76 (message "%s signed off from %s" nick server))
77
78;;;; Internal variables
79
80(defvar erc-last-ison nil
81 "Last ISON information received through `erc-notify-timer'.")
82(make-variable-buffer-local 'erc-last-ison)
83
84(defvar erc-last-ison-time 0
85 "Last time ISON was sent to the server in `erc-notify-timer'.")
86(make-variable-buffer-local 'erc-last-ison-time)
87
88;;;; Setup
89
90(defun erc-notify-install-message-catalogs ()
91 (erc-define-catalog
92 'english
93 '((notify_current . "Notificated people online: %l")
94 (notify_list . "Current notify list: %l")
95 (notify_on . "Detected %n on IRC network %m")
96 (notify_off . "%n has left IRC network %m"))))
97
98;;;###autoload (autoload 'erc-notify-mode "erc-notify" nil t)
99(define-erc-module notify nil
100 "Periodically check for the online status of certain users and report
101changes."
102 ((add-hook 'erc-timer-hook 'erc-notify-timer)
103 (add-hook 'erc-server-JOIN-functions 'erc-notify-JOIN)
104 (add-hook 'erc-server-NICK-functions 'erc-notify-NICK)
105 (add-hook 'erc-server-QUIT-functions 'erc-notify-QUIT))
106 ((remove-hook 'erc-timer-hook 'erc-notify-timer)
107 (remove-hook 'erc-server-JOIN-functions 'erc-notify-JOIN)
108 (remove-hook 'erc-server-NICK-functions 'erc-notify-NICK)
109 (remove-hook 'erc-server-QUIT-functions 'erc-notify-QUIT)))
110
111;;;; Timer handler
112
113(defun erc-notify-timer (now)
114 (when (and erc-notify-list
115 (> (erc-time-diff
116 erc-last-ison-time now)
117 erc-notify-interval))
118 (erc-once-with-server-event
119 303
120 '(let* ((server (erc-response.sender parsed))
121 (ison-list (delete "" (split-string
122 (erc-response.contents parsed))))
123 (new-list ison-list)
124 (old-list (with-current-buffer (erc-server-buffer)
125 erc-last-ison)))
126 (while new-list
127 (when (not (erc-member-ignore-case (car new-list) old-list))
128 (run-hook-with-args 'erc-notify-signon-hook server (car new-list))
129 (erc-display-message
130 parsed 'notice proc
131 'notify_on ?n (car new-list) ?m (erc-network-name)))
132 (setq new-list (cdr new-list)))
133 (while old-list
134 (when (not (erc-member-ignore-case (car old-list) ison-list))
135 (run-hook-with-args 'erc-notify-signoff-hook server (car old-list))
136 (erc-display-message
137 parsed 'notice proc
138 'notify_off ?n (car old-list) ?m (erc-network-name)))
139 (setq old-list (cdr old-list)))
140 (setq erc-last-ison ison-list)
141 t))
142 (erc-server-send
143 (concat "ISON " (mapconcat 'identity erc-notify-list " ")))
144 (setq erc-last-ison-time now)))
145
146(defun erc-notify-JOIN (proc parsed)
147 "Check if channel joiner is on `erc-notify-list' and not on `erc-last-ison'.
148If this condition is satisfied, produce a notify_on message and add the nick
149to `erc-last-ison' to prevent any further notifications."
150 (let ((nick (erc-extract-nick (erc-response.sender parsed))))
151 (when (and (erc-member-ignore-case nick erc-notify-list)
152 (not (erc-member-ignore-case nick erc-last-ison)))
153 (add-to-list 'erc-last-ison nick)
154 (run-hook-with-args 'erc-notify-signon-hook
155 (or erc-server-announced-name erc-session-server)
156 nick)
157 (erc-display-message
158 parsed 'notice proc
159 'notify_on ?n nick ?m (erc-network-name)))
160 nil))
161
162(defun erc-notify-NICK (proc parsed)
163 "Check if new nick is on `erc-notify-list' and not on `erc-last-ison'.
164If this condition is satisfied, produce a notify_on message and add the nick
165to `erc-last-ison' to prevent any further notifications."
166 (let ((nick (erc-response.contents parsed)))
167 (when (and (erc-member-ignore-case nick erc-notify-list)
168 (not (erc-member-ignore-case nick erc-last-ison)))
169 (add-to-list 'erc-last-ison nick)
170 (run-hook-with-args 'erc-notify-signon-hook
171 (or erc-server-announced-name erc-session-server)
172 nick)
173 (erc-display-message
174 parsed 'notice proc
175 'notify_on ?n nick ?m (erc-network-name)))
176 nil))
177
178(defun erc-notify-QUIT (proc parsed)
179 "Check if quitter is on `erc-notify-list' and on `erc-last-ison'.
180If this condition is satisfied, produce a notify_off message and remove the
181nick from `erc-last-ison' to prevent any further notifications."
182 (let ((nick (erc-extract-nick (erc-response.sender parsed))))
183 (when (and (erc-member-ignore-case nick erc-notify-list)
184 (erc-member-ignore-case nick erc-last-ison))
185 (setq erc-last-ison (erc-delete-if `(lambda (el)
186 (string= ,(erc-downcase nick)
187 (erc-downcase el)))
188 erc-last-ison))
189 (run-hook-with-args 'erc-notify-signoff-hook
190 (or erc-server-announced-name erc-session-server)
191 nick)
192 (erc-display-message
193 parsed 'notice proc
194 'notify_off ?n nick ?m (erc-network-name)))
195 nil))
196
197;;;; User level command
198
199;;;###autoload
200(defun erc-cmd-NOTIFY (&rest args)
201 "Change `erc-notify-list' or list current notify-list members online.
202Without args, list the current list of notificated people online,
203with args, toggle notify status of people."
204 (cond
205 ((null args)
206 ;; Print current notificated people (online)
207 (let ((ison (with-current-buffer (erc-server-buffer) erc-last-ison)))
208 (if (not ison)
209 (erc-display-message
210 nil 'notice 'active "No ison-list yet!")
211 (erc-display-message
212 nil 'notice 'active
213 'notify_current ?l ison))))
214 ((string= (car args) "-l")
215 (erc-display-message nil 'notice 'active
216 'notify_list ?l (mapconcat 'identity erc-notify-list
217 " ")))
218 (t
219 (while args
220 (if (erc-member-ignore-case (car args) erc-notify-list)
221 (progn
222 (setq erc-notify-list (delete (car args) erc-notify-list))
223 ;; Remove the nick from the value of erc-last-ison in
224 ;; every server buffer. This prevents seeing a signoff
225 ;; notification for a nick that you have just _removed_
226 ;; from your notify list.
227 (dolist (buf (erc-buffer-list))
228 (with-current-buffer buf
229 (if (erc-server-buffer-p)
230 (setq erc-last-ison (delete (car args) erc-last-ison))))))
231 (setq erc-notify-list (cons (erc-string-no-properties (car args))
232 erc-notify-list)))
233 (setq args (cdr args)))
234 (erc-display-message
235 nil 'notice 'active
236 'notify_list ?l (mapconcat 'identity erc-notify-list " "))))
237 t)
238
239;;;###autoload
240(defun pcomplete/erc-mode/NOTIFY ()
241 (pcomplete-here (pcomplete-erc-all-nicks)))
242
243(erc-notify-install-message-catalogs)
244
245(provide 'erc-notify)
246
247;;; erc-notify.el ends here
248;;
249;; Local Variables:
250;; indent-tabs-mode: t
251;; tab-width: 8
252;; End:
253
254;; arch-tag: 0fb19dd0-1359-458a-89b7-81dc195a588e
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
new file mode 100644
index 00000000000..d8e677031e3
--- /dev/null
+++ b/lisp/erc/erc-page.el
@@ -0,0 +1,108 @@
1;; erc-page.el - CTCP PAGE support for ERC
2
3;; Copyright (C) 2002, 2004 Free Software Foundation
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs; see the file COPYING. If not, write to the
19;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20;; Boston, MA 02110-1301, USA.
21
22;;; Commentary:
23
24;; Requiring this file will make ERC react to CTCP PAGE messages
25;; received, and it will provide a new /PAGE command to send such
26;; messages yourself. To enable it, customize the variable
27;; `erc-page-mode'.
28
29;;; Code:
30
31(require 'erc)
32
33;;;###autoload (autoload 'erc-page-mode "erc-page")
34(define-erc-module page ctcp-page
35 "Process CTCP PAGE requests from IRC."
36 nil nil)
37
38(erc-define-catalog-entry 'english 'CTCP-PAGE "Page from %n (%u@%h): %m")
39
40(defgroup erc-page nil
41 "React to CTCP PAGE messages."
42 :group 'erc)
43
44(defcustom erc-page-function nil
45 "A function to process a \"page\" request.
46If nil, this prints the page message in the minibuffer and calls
47`beep'. If non-nil, it must be a function that takes two arguments:
48SENDER and MSG, both strings.
49
50Example for your ~/.emacs file:
51
52\(setq erc-page-function
53 (lambda (sender msg)
54 (play-sound-file \"/home/alex/elisp/erc/sounds/ni.wav\")
55 (message \"IRC Page from %s: %s\" sender msg)))"
56 :group 'erc-page
57 :type '(choice (const nil)
58 (function)))
59
60(defcustom erc-ctcp-query-PAGE-hook '(erc-ctcp-query-PAGE)
61 "List of functions to be called when a CTCP PAGE is received.
62This is called from `erc-process-ctcp-query'. The functions are called
63with six arguments: PROC NICK LOGIN HOST TO MSG. Note that you can
64also set `erc-page-function' to a function, which only gets two arguments,
65SENDER and MSG, so that might be easier to use."
66 :group 'erc-page
67 :type '(repeat function))
68
69(defun erc-ctcp-query-PAGE (proc nick login host to msg)
70 "Deal with an CTCP PAGE query, if `erc-page-mode' is non-nil.
71This will call `erc-page-function', if defined, or it will just print
72a message and `beep'. In addition to that, the page message is also
73inserted into the server buffer."
74 (when (and erc-page-mode
75 (string-match "PAGE\\(\\s-+.*\\)?$" msg))
76 (let* ((m (match-string 1 msg))
77 (page-msg (if m (erc-controls-interpret (substring m 1))
78 "[no message]"))
79 text)
80 (if m (setq m (substring m 1)))
81 (setq text (erc-format-message 'CTCP-PAGE
82 ?n nick ?u login
83 ?h host ?m page-msg))
84 (if erc-page-function
85 (funcall erc-page-function nick page-msg)
86 ;; if no function is defined
87 (message "%s" text)
88 (beep))
89 ;; insert text into buffer
90 (erc-display-message
91 nil 'notice nil text)))
92 nil)
93
94(defun erc-cmd-PAGE (line &optional force)
95 "Send a CTCP page to the user given as the first word in LINE.
96The rest of LINE is the message to send. Note that you will only
97receive pages if `erc-page-mode' is on."
98 (when (string-match "^\\s-*\\(\\S-+\\) ?\\(.*\\)" line)
99 (let ((nick (match-string 1 line))
100 (msg (match-string 2 line)))
101 (erc-cmd-CTCP nick "PAGE" msg))))
102
103(put 'erc-cmd-PAGE 'do-not-parse-args t)
104
105(provide 'erc-page)
106
107;; arch-tag: 82fd2e0e-6060-4dd2-9788-8c1411e844de
108;;; erc-page.el ends here
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
new file mode 100644
index 00000000000..110704304e2
--- /dev/null
+++ b/lisp/erc/erc-pcomplete.el
@@ -0,0 +1,275 @@
1;;; erc-pcomplete.el --- Provides programmable completion for ERC
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Sacha Chua <sacha@free.net.ph>
6;; Keywords: comm, convenience
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcCompletion
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file replaces erc-complete.el. It provides nick completion
29;; for ERC based on pcomplete. If you do not have pcomplete, you may
30;; try to use erc-complete.el.
31;;
32;; To use, (require 'erc-auto) or (require 'erc-pcomplete), then
33;; (erc-pcomplete-mode 1)
34;;
35;; If you want nickname completions ordered such that the most recent
36;; speakers are listed first, set
37;; `erc-pcomplete-order-nickname-completions' to `t'.
38;;
39;; See CREDITS for other contributors.
40;;
41;;; Code:
42
43(require 'pcomplete)
44(require 'erc)
45(require 'erc-compat)
46(require 'time-date)
47(eval-when-compile (require 'cl))
48
49(defgroup erc-pcomplete nil
50 "Programmable completion for ERC"
51 :group 'erc)
52
53(defcustom erc-pcomplete-nick-postfix ": "
54 "*When `pcomplete' is used in the first word after the prompt,
55add this string to nicks completed."
56 :group 'erc-pcomplete
57 :type 'string)
58
59(defcustom erc-pcomplete-order-nickname-completions t
60 "If t, channel nickname completions will be ordered such that
61the most recent speakers are listed first."
62 :group 'erc-pcomplete
63 :type 'boolean)
64
65;;;###autoload (autoload 'erc-completion-mode "erc-pcomplete" nil t)
66(define-erc-module pcomplete Completion
67 "In ERC Completion mode, the TAB key does completion whenever possible."
68 ((add-hook 'erc-mode-hook 'pcomplete-erc-setup)
69 (add-hook 'erc-complete-functions 'erc-pcomplete)
70 (erc-buffer-list #'pcomplete-erc-setup))
71 ((remove-hook 'erc-mode-hook 'pcomplete-erc-setup)
72 (remove-hook 'erc-complete-functions 'erc-pcomplete)))
73
74(defun erc-pcomplete ()
75 "Complete the nick before point."
76 (interactive)
77 (when (> (point) (erc-beg-of-input-line))
78 (let ((last-command (if (eq last-command 'erc-complete-word)
79 'pcomplete
80 last-command)))
81 (call-interactively 'pcomplete))
82 t))
83
84;;; Setup function
85
86(defun pcomplete-erc-setup ()
87 "Setup `erc-mode' to use pcomplete."
88 (set (make-local-variable 'pcomplete-ignore-case)
89 t)
90 (set (make-local-variable 'pcomplete-use-paring)
91 nil)
92 (set (make-local-variable 'pcomplete-suffix-list)
93 '(? ?:))
94 (set (make-local-variable 'pcomplete-parse-arguments-function)
95 'pcomplete-parse-erc-arguments)
96 (set (make-local-variable 'pcomplete-command-completion-function)
97 'pcomplete/erc-mode/complete-command)
98 (set (make-local-variable 'pcomplete-command-name-function)
99 'pcomplete-erc-command-name)
100 (set (make-local-variable 'pcomplete-default-completion-function)
101 (lambda () (pcomplete-here (pcomplete-erc-nicks)))))
102
103;;; Programmable completion logic
104
105(defun pcomplete/erc-mode/complete-command ()
106 (pcomplete-here
107 (append
108 (pcomplete-erc-commands)
109 (pcomplete-erc-nicks erc-pcomplete-nick-postfix))))
110
111(defvar erc-pcomplete-ctcp-commands
112 '("ACTION" "CLIENTINFO" "ECHO" "FINGER" "PING" "TIME" "USERINFO" "VERSION"))
113
114(defun pcomplete/erc-mode/CTCP ()
115 (pcomplete-here (pcomplete-erc-nicks))
116 (pcomplete-here erc-pcomplete-ctcp-commands))
117
118(defun pcomplete/erc-mode/CLEARTOPIC ()
119 (pcomplete-here (pcomplete-erc-channels)))
120
121(defun pcomplete/erc-mode/DEOP ()
122 (while (pcomplete-here (pcomplete-erc-ops))))
123
124(defun pcomplete/erc-mode/DESCRIBE ()
125 (pcomplete-here (pcomplete-erc-nicks)))
126
127(defun pcomplete/erc-mode/IDLE ()
128 (while (pcomplete-here (pcomplete-erc-nicks))))
129
130(defun pcomplete/erc-mode/KICK ()
131 (pcomplete-here (pcomplete-erc-channels))
132 (pcomplete-here (pcomplete-erc-nicks)))
133
134(defun pcomplete/erc-mode/LOAD ()
135 (pcomplete-here (pcomplete-entries)))
136
137(defun pcomplete/erc-mode/MODE ()
138 (pcomplete-here (pcomplete-erc-channels))
139 (while (pcomplete-here (pcomplete-erc-nicks))))
140
141(defun pcomplete/erc-mode/ME ()
142 (while (pcomplete-here (pcomplete-erc-nicks))))
143
144(defun pcomplete/erc-mode/SAY ()
145 (pcomplete-here (pcomplete-erc-nicks))
146 (pcomplete-here (pcomplete-erc-nicks))
147 (while (pcomplete-here (pcomplete-erc-nicks))))
148
149(defun pcomplete/erc-mode/MSG ()
150 (pcomplete-here (append (pcomplete-erc-all-nicks)
151 (pcomplete-erc-channels)))
152 (while (pcomplete-here (pcomplete-erc-nicks))))
153
154(defun pcomplete/erc-mode/NAMES ()
155 (while (pcomplete-here (pcomplete-erc-channels))))
156
157(defalias 'pcomplete/erc-mode/NOTICE 'pcomplete/erc-mode/MSG)
158
159(defun pcomplete/erc-mode/OP ()
160 (while (pcomplete-here (pcomplete-erc-not-ops))))
161
162(defun pcomplete/erc-mode/PART ()
163 (pcomplete-here (pcomplete-erc-channels)))
164
165(defalias 'pcomplete/erc-mode/LEAVE 'pcomplete/erc-mode/PART)
166
167(defun pcomplete/erc-mode/QUERY ()
168 (pcomplete-here (append (pcomplete-erc-all-nicks)
169 (pcomplete-erc-channels)))
170 (while (pcomplete-here (pcomplete-erc-nicks)))
171 )
172
173(defun pcomplete/erc-mode/SOUND ()
174 (while (pcomplete-here (pcomplete-entries))))
175
176(defun pcomplete/erc-mode/TOPIC ()
177 (pcomplete-here (pcomplete-erc-channels)))
178
179(defun pcomplete/erc-mode/WHOIS ()
180 (while (pcomplete-here (pcomplete-erc-nicks))))
181
182(defun pcomplete/erc-mode/UNIGNORE ()
183 (pcomplete-here (with-current-buffer (erc-server-buffer) erc-ignore-list)))
184
185;;; Functions that provide possible completions.
186
187(defun pcomplete-erc-commands ()
188 "Returns a list of strings of the defined user commands."
189 (let ((case-fold-search nil))
190 (mapcar (lambda (x)
191 (concat "/" (downcase (substring (symbol-name x) 8))))
192 (apropos-internal "erc-cmd-[A-Z]+"))))
193
194(defun pcomplete-erc-ops ()
195 "Returns a list of nicks with ops."
196 (let (ops)
197 (maphash (lambda (nick cdata)
198 (if (and (cdr cdata)
199 (erc-channel-user-op (cdr cdata)))
200 (setq ops (cons nick ops))))
201 erc-channel-users)
202 ops))
203
204(defun pcomplete-erc-not-ops ()
205 "Returns a list of nicks without ops."
206 (let (not-ops)
207 (maphash (lambda (nick cdata)
208 (if (and (cdr cdata)
209 (not (erc-channel-user-op (cdr cdata))))
210 (setq not-ops (cons nick not-ops))))
211 erc-channel-users)
212 not-ops))
213
214
215(defun pcomplete-erc-nicks (&optional postfix)
216 "Returns a list of nicks in the current channel."
217 (let ((users (erc-get-channel-user-list)))
218 (if erc-pcomplete-order-nickname-completions
219 (setq users (erc-sort-channel-users-by-activity users)))
220 (mapcar (lambda (x)
221 (concat (erc-server-user-nickname (car x)) postfix))
222 users)))
223
224(defun pcomplete-erc-all-nicks (&optional postfix)
225 "Returns a list of all nicks on the current server."
226 (let (nicks)
227 (with-current-buffer (process-buffer erc-server-process)
228 (maphash (lambda (nick user)
229 (setq nicks (cons (concat nick postfix) nicks)))
230 erc-server-users))
231 nicks))
232
233(defun pcomplete-erc-channels ()
234 "Returns a list of channels associated with the current server."
235 (mapcar (lambda (buf) (with-current-buffer buf (erc-default-target)))
236 (erc-channel-list erc-server-process)))
237
238;;; Functions for parsing
239
240(defun pcomplete-erc-command-name ()
241 "Returns the command name of the first argument."
242 (if (eq (elt (pcomplete-arg 'first) 0) ?/)
243 (upcase (substring (pcomplete-arg 'first) 1))
244 "SAY"))
245
246(defun pcomplete-parse-erc-arguments ()
247 "Returns a list of parsed whitespace-separated arguments.
248These are the words from the beginning of the line after the prompt
249up to where point is right now."
250 (let* ((start erc-input-marker)
251 (end (point))
252 args beginnings)
253 (save-excursion
254 (if (< (skip-chars-backward " \t\n" start) 0)
255 (setq args '("")
256 beginnings (list end)))
257 (setq end (point))
258 (while (< (skip-chars-backward "^ \t\n" start) 0)
259 (setq beginnings (cons (point) beginnings)
260 args (cons (buffer-substring-no-properties
261 (point) end)
262 args))
263 (skip-chars-backward " \t\n" start)
264 (setq end (point))))
265 (cons args beginnings)))
266
267(provide 'erc-pcomplete)
268
269;;; erc-pcomplete.el ends here
270;;
271;; Local Variables:
272;; indent-tabs-mode: nil
273;; End:
274
275;; arch-tag: 32a7703b-be87-45a4-82f3-9eed5a628911
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
new file mode 100644
index 00000000000..07e8cd16138
--- /dev/null
+++ b/lisp/erc/erc-replace.el
@@ -0,0 +1,93 @@
1;; erc-replace.el -- wash and massage messages inserted into the buffer
2
3;; Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
4
5;; Author: Andreas Fuchs <asf@void.at>
6;; Maintainer: Mario Lang (mlang@delysid.org)
7;; Keywords: IRC, client, Internet
8;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcReplace
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28
29;; This module allows you to systematically replace text in incoming
30;; messages. Load erc-replace, and customize `erc-replace-alist'.
31;; Then add to your ~/.emacs:
32
33;; (require 'erc-replace)
34;; (erc-replace-mode 1)
35
36;;; Code:
37
38(require 'erc)
39
40(defgroup erc-replace nil
41 "Replace text from incoming messages"
42 :group 'erc)
43
44(defcustom erc-replace-alist nil
45 "Alist describing text to be replaced in incoming messages.
46This is useful for filters.
47
48The alist has elements of the form (FROM . TO). FROM can be a regular
49expression or a variable, or any sexp, TO can be a string or a
50function to call, or any sexp. If a function, it will be called with
51one argument, the string to be replaced, and it should return a
52replacement string."
53 :group 'erc-replace
54 :type '(repeat (cons :tag "Search & Replace"
55 (choice :tag "From"
56 regexp
57 variable
58 sexp)
59 (choice :tag "To"
60 string
61 function
62 sexp))))
63
64(defun erc-replace-insert ()
65 "Function to run from `erc-insert-modify-hook'.
66It replaces text according to `erc-replace-alist'."
67 (mapcar (lambda (elt)
68 (goto-char (point-min))
69 (let ((from (car elt))
70 (to (cdr elt)))
71 (unless (stringp from)
72 (setq from (eval from)))
73 (while (re-search-forward from nil t)
74 (cond ((stringp to)
75 (replace-match to))
76 ((and (symbolp to) (fboundp to))
77 (replace-match (funcall to (match-string 0))))
78 (t
79 (eval to))))))
80 erc-replace-alist))
81
82;;;###autoload (autoload 'erc-replace-mode "erc-replace")
83(define-erc-module replace nil
84 "This mode replaces incoming text according to `erc-replace-alist'."
85 ((add-hook 'erc-insert-modify-hook
86 'erc-replace-insert))
87 ((remove-hook 'erc-insert-modify-hook
88 'erc-replace-insert)))
89
90(provide 'erc-replace)
91
92;; arch-tag: dd904a59-d8a6-47f8-ac3a-76b698289a18
93;;; erc-replace.el ends here
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
new file mode 100644
index 00000000000..cabb8e2905f
--- /dev/null
+++ b/lisp/erc/erc-ring.el
@@ -0,0 +1,148 @@
1;; erc-ring.el -- Command history handling for erc using ring.el
2
3;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; Keywords: comm
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcHistory
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This file implements an input ring -- a history of the stuff you
29;; wrote. To activate:
30;;
31;; (require 'erc-auto) or (require 'erc-ring)
32;; (erc-ring-mode 1)
33;;
34;; Use M-n and M-p to navigate the ring
35
36;;; Code:
37
38(require 'erc)
39(require 'comint)
40(require 'ring)
41
42;;;###autoload (autoload 'erc-ring-mode "erc-ring" nil t)
43(define-erc-module ring nil
44 "Stores input in a ring so that previous commands and messages can
45be recalled using M-p and M-n."
46 ((add-hook 'erc-send-pre-hook 'erc-add-to-input-ring)
47 (define-key erc-mode-map "\M-p" 'erc-previous-command)
48 (define-key erc-mode-map "\M-n" 'erc-next-command))
49 ((remove-hook 'erc-send-pre-hook 'erc-add-to-input-ring)
50 (define-key erc-mode-map "\M-p" 'undefined)
51 (define-key erc-mode-map "\M-n" 'undefined)))
52
53(defvar erc-input-ring nil "Input ring for erc.")
54(make-variable-buffer-local 'erc-input-ring)
55
56(defvar erc-input-ring-index nil
57 "Position in the input ring for erc.
58If nil, the input line is blank and the user is conceptually 'after'
59the most recently added item in the ring. If an integer, the input
60line is non-blank and displays the item from the ring indexed by this
61variable.")
62(make-variable-buffer-local 'erc-input-ring-index)
63
64(defun erc-input-ring-setup ()
65 "Do the setup required so that we can use comint style input rings.
66Call this function when setting up the mode."
67 (setq erc-input-ring (make-ring comint-input-ring-size))
68 (setq erc-input-ring-index nil))
69
70(defun erc-add-to-input-ring (s)
71 "Add string S to the input ring and reset history position."
72 (unless erc-input-ring (erc-input-ring-setup))
73 (ring-insert erc-input-ring s)
74 (setq erc-input-ring-index nil))
75
76(defun erc-clear-input-ring ()
77 "Remove all entries from the input ring, then call garbage-collect.
78You might use this for security purposes if you have typed a command
79containing a password."
80 (interactive)
81 (setq erc-input-ring (make-ring comint-input-ring-size)
82 erc-input-ring-index nil)
83 (garbage-collect)
84 (message "ERC input ring cleared."))
85
86(defun erc-previous-command ()
87 "Replace current command with the previous one from the history."
88 (interactive)
89 (unless erc-input-ring (erc-input-ring-setup))
90 ;; if the ring isn't empty
91 (when (> (ring-length erc-input-ring) 0)
92 (if (and erc-input-ring-index
93 (= (ring-length erc-input-ring) (1+ erc-input-ring-index)))
94 (progn
95 (erc-replace-current-command "")
96 (setq erc-input-ring-index nil))
97
98 ;; If we are not viewing old input and there's text in the input
99 ;; area, push it on the history ring before moving back through
100 ;; the input history, so it will be there when we return to the
101 ;; front.
102 (if (null erc-input-ring-index)
103 (when (> (point-max) erc-input-marker)
104 (erc-add-to-input-ring (buffer-substring erc-input-marker
105 (point-max)))
106 (setq erc-input-ring-index 0)))
107
108 (setq erc-input-ring-index (if erc-input-ring-index
109 (ring-plus1 erc-input-ring-index
110 (ring-length erc-input-ring))
111 0))
112 (erc-replace-current-command (ring-ref erc-input-ring
113 erc-input-ring-index)))))
114
115(defun erc-next-command ()
116 "Replace current command with the next one from the history."
117 (interactive)
118 (unless erc-input-ring (erc-input-ring-setup))
119 ;; if the ring isn't empty
120 (when (> (ring-length erc-input-ring) 0)
121 (if (and erc-input-ring-index
122 (= 0 erc-input-ring-index))
123 (progn
124 (erc-replace-current-command "")
125 (setq erc-input-ring-index nil))
126 (setq erc-input-ring-index (ring-minus1 (or erc-input-ring-index 0)
127 (ring-length erc-input-ring)))
128 (erc-replace-current-command (ring-ref erc-input-ring
129 erc-input-ring-index)))))
130
131
132(defun erc-replace-current-command (s)
133 "Replace current command with string S."
134 ;; delete line
135 (let ((inhibit-read-only t))
136 (delete-region
137 (progn (goto-char erc-insert-marker) (erc-bol))
138 (goto-char (point-max)))
139 (insert s)))
140
141(provide 'erc-ring)
142
143;;; erc-ring.el ends here
144;; Local Variables:
145;; indent-tabs-mode: nil
146;; End:
147
148;; arch-tag: b77924a8-a80e-489d-84cd-b351761ea5c8
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
new file mode 100644
index 00000000000..c5b0f8177f2
--- /dev/null
+++ b/lisp/erc/erc-sound.el
@@ -0,0 +1,149 @@
1;;; erc-sound.el --- CTCP SOUND support for ERC
2
3;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs; see the file COPYING. If not, write to the
19;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20;; Boston, MA 02110-1301, USA.
21
22;;; Commentary:
23
24;; This used to be in erc.el, I (Jorgen) just extracted it from there
25;; and put it in this file. Bugs and features are those of the
26;; original author.
27
28;;; Code:
29
30(require 'erc)
31
32;;;###autoload (autoload 'erc-sound-mode "erc-sound")
33(define-erc-module sound ctcp-sound
34 "In ERC sound mode, the client will respond to CTCP SOUND requests
35and play sound files as requested."
36 ;; Enable:
37 ((define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
38 ;; Disable:
39 ((define-key erc-mode-map "\C-c\C-s" 'undefined)))
40
41(erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m")
42
43(defgroup erc-sound nil
44 "Make ERC play bells and whistles while chatting with people."
45 :group 'erc)
46
47(defcustom erc-play-sound t
48 "*Play sound on SOUND ctcp requests (used in ICQ chat)."
49 :group 'erc-sound
50 :type 'boolean)
51
52(defcustom erc-sound-path nil
53 "List of directories that contain sound samples to play on SOUND events."
54 :group 'erc-sound
55 :type '(repeat directory))
56
57(defcustom erc-default-sound nil
58 "Play this sound if the requested file was not found."
59 :group 'erc-sound
60 :type '(choice (const nil)
61 file))
62
63(defcustom erc-play-command "play"
64 "Command for playing sound samples."
65 :group 'erc-sound
66 :type 'string)
67
68(defun erc-cmd-SOUND (line &optional force)
69 "Play the sound given in LINE."
70 (cond
71 ((string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*\\)?$" line)
72 (let ((file (match-string 1 line))
73 (msg (match-string 2 line))
74 (tgt (erc-default-target)))
75 (if (null msg)
76 (setq msg "")
77 ;; remove the first white space
78 (setq msg (substring msg 1)))
79 (if tgt
80 (progn
81 (erc-send-ctcp-message tgt (format "SOUND %s %s" file msg) force)
82 (if erc-play-sound (erc-play-sound file)))
83 (erc-display-message nil 'error (current-buffer) 'no-target))
84 t))
85 (t nil)))
86
87(defvar erc-ctcp-query-SOUND-hook '(erc-ctcp-query-SOUND))
88(defun erc-ctcp-query-SOUND (proc nick login host to msg)
89 (when (string-match "^SOUND\\s-+\\(\\S-+\\)\\(\\(\\s-+.*\\)\\|\\(\\s-*\\)\\)$" msg)
90 (let ((sound (match-string 1 msg))
91 (comment (match-string 2 msg)))
92 (when erc-play-sound (erc-play-sound sound))
93 (erc-display-message
94 nil 'notice nil
95 'CTCP-SOUND ?n nick ?u login ?h host ?s sound ?m comment)))
96 nil)
97
98(defun erc-play-sound (file)
99 "Plays a sound file located in one of the directories in `erc-sound-path'
100with a command `erc-play-command'."
101 (let ((filepath (erc-find-file file erc-sound-path)))
102 (if (and (not filepath) erc-default-sound)
103 (setq filepath erc-default-sound))
104 (cond ((and filepath (file-exists-p filepath))
105 (if (and (fboundp 'device-sound-enabled-p)
106 (device-sound-enabled-p))
107 ; For XEmacs
108 (play-sound-file filepath)
109; (start-process "erc-sound" nil erc-play-command filepath)
110 (start-process "erc-sound" nil "/bin/tcsh" "-c"
111 (concat erc-play-command " " filepath))))
112 (t (beep)))
113 (erc-log (format "Playing sound file %S" filepath))))
114
115;(defun erc-play-sound (file)
116; "Plays a sound file located in one of the directories in `erc-sound-path'
117; with a command `erc-play-command'."
118; (let ((filepath nil)
119; (paths erc-sound-path))
120; (while (and paths
121; (progn (setq filepath (expand-file-name file (car paths)))
122; (not (file-exists-p filepath))))
123; (setq paths (cdr paths)))
124; (if (and (not (and filepath (file-exists-p filepath)))
125; erc-default-sound)
126; (setq filepath erc-default-sound))
127; (cond ((and filepath (file-exists-p filepath))
128;; (start-process "erc-sound" nil erc-play-command filepath)
129; (start-process "erc-sound" nil "/bin/tcsh" "-c"
130; (concat erc-play-command " " filepath))
131; )
132; (t (beep)))
133; (erc-log (format "Playing sound file %S" filepath))))
134
135(defun erc-toggle-sound (&optional arg)
136 "Toggles playing sounds on and off. With positive argument,
137 turns them on. With any other argument turns sounds off."
138 (interactive "P")
139 (cond ((and (numberp arg) (> arg 0))
140 (setq erc-play-sound t))
141 (arg (setq erc-play-sound nil))
142 (t (setq erc-play-sound (not erc-play-sound))))
143 (message "ERC sound is %s" (if erc-play-sound "ON" "OFF")))
144
145
146(provide 'erc-sound)
147
148;; arch-tag: 53657d1d-007f-4a20-91c1-588e71cf0cee
149;;; erc-sound.el ends here
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
new file mode 100644
index 00000000000..e6ca5382338
--- /dev/null
+++ b/lisp/erc/erc-speedbar.el
@@ -0,0 +1,369 @@
1;;; erc-speedbar.el --- Speedbar support for ERC
2
3;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Contributor: Eric M. Ludlam <eric@siege-engine.com>
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This module provides integration of ERC into the Speedbar.
28
29;;; TODO / ideas:
30
31;; * Write intelligent update function:
32;; update-channel, update-nick, remove-nick-from-channel, ...
33;; * Use indicator-strings for op/voice
34;; * Extract/convert face notes field from bbdb if available and show
35;; it using sb-image.el
36;;
37;;; Code:
38
39(require 'erc)
40(require 'speedbar)
41(condition-case nil (require 'dframe) (error nil))
42
43;;; Customization:
44
45(defgroup erc-speedbar nil
46 "Integration of ERC in the Speedbar"
47 :group 'erc)
48
49(defcustom erc-speedbar-sort-users-type 'activity
50 "How channel nicknames are sorted.
51
52'activity - Sort users by channel activity
53'alphabetical - Sort users alphabetically
54nil - Do not sort users"
55 :group 'erc-speedbar
56 :type '(choice (const :tag "Sort users by channel activity" activity)
57 (const :tag "Sort users alphabetically" alphabetical)
58 (const :tag "Do not sort users" nil)))
59
60(defvar erc-speedbar-key-map nil
61 "Keymap used when in erc display mode.")
62
63(defun erc-install-speedbar-variables ()
64 "Install those variables used by speedbar to enhance ERC."
65 (if erc-speedbar-key-map
66 nil
67 (setq erc-speedbar-key-map (speedbar-make-specialized-keymap))
68
69 ;; Basic tree features
70 (define-key erc-speedbar-key-map "e" 'speedbar-edit-line)
71 (define-key erc-speedbar-key-map "\C-m" 'speedbar-edit-line)
72 (define-key erc-speedbar-key-map "+" 'speedbar-expand-line)
73 (define-key erc-speedbar-key-map "=" 'speedbar-expand-line)
74 (define-key erc-speedbar-key-map "-" 'speedbar-contract-line))
75
76 (speedbar-add-expansion-list '("ERC" erc-speedbar-menu-items
77 erc-speedbar-key-map
78 erc-speedbar-server-buttons))
79 (speedbar-add-mode-functions-list
80 '("ERC" (speedbar-item-info . erc-speedbar-item-info))))
81
82(defvar erc-speedbar-menu-items
83 '(["Goto buffer" speedbar-edit-line t]
84 ["Expand Node" speedbar-expand-line
85 (save-excursion (beginning-of-line)
86 (looking-at "[0-9]+: *.\\+. "))]
87 ["Contract Node" speedbar-contract-line
88 (save-excursion (beginning-of-line)
89 (looking-at "[0-9]+: *.-. "))])
90 "Additional menu-items to add to speedbar frame.")
91
92;; Make sure our special speedbar major mode is loaded
93(if (featurep 'speedbar)
94 (erc-install-speedbar-variables)
95 (add-hook 'speedbar-load-hook 'erc-install-speedbar-variables))
96
97;;; ERC hierarchy display method
98;;;###autoload
99(defun erc-speedbar-browser ()
100 "Initialize speedbar to display an ERC browser.
101This will add a speedbar major display mode."
102 (interactive)
103 (require 'speedbar)
104 ;; Make sure that speedbar is active
105 (speedbar-frame-mode 1)
106 ;; Now, throw us into Info mode on speedbar.
107 (speedbar-change-initial-expansion-list "ERC")
108 (speedbar-get-focus))
109
110(defun erc-speedbar-buttons (buffer)
111 "Create buttons for speedbar in BUFFER."
112 (erase-buffer)
113 (let (serverp chanp)
114 (with-current-buffer buffer
115 (setq serverp (eq buffer (process-buffer erc-server-process)))
116 (setq chanp (erc-channel-p (erc-default-target)))
117 (setq queryp (erc-query-buffer-p)))
118 (cond (serverp
119 (erc-speedbar-channel-buttons nil 0 buffer))
120 (chanp
121 (erc-speedbar-insert-target buffer 0)
122 (forward-line -1)
123 (erc-speedbar-expand-channel "+" buffer 0))
124 (queryp
125 (erc-speedbar-insert-target buffer 0))
126 (t (ignore)))))
127
128(defun erc-speedbar-server-buttons (directory depth)
129 "Insert the initial list of servers you are connected to."
130 (let ((servers (erc-buffer-list
131 (lambda ()
132 (eq (current-buffer)
133 (process-buffer erc-server-process))))))
134 (when servers
135 (speedbar-with-writable
136 (dolist (server servers)
137 (speedbar-make-tag-line
138 'bracket ?+ 'erc-speedbar-expand-server server
139 (buffer-name server) 'erc-speedbar-goto-buffer server nil
140 depth))
141 t))))
142
143(defun erc-speedbar-expand-server (text server indent)
144 (cond ((string-match "+" text)
145 (speedbar-change-expand-button-char ?-)
146 (if (speedbar-with-writable
147 (save-excursion
148 (end-of-line) (forward-char 1)
149 (erc-speedbar-channel-buttons nil (1+ indent) server)))
150 (speedbar-change-expand-button-char ?-)
151 (speedbar-change-expand-button-char ??)))
152 ((string-match "-" text) ;we have to contract this node
153 (speedbar-change-expand-button-char ?+)
154 (speedbar-delete-subblock indent))
155 (t (error "Ooops... not sure what to do")))
156 (speedbar-center-buffer-smartly))
157
158(defun erc-speedbar-channel-buttons (directory depth server-buffer)
159 (when (get-buffer server-buffer)
160 (let* ((proc (with-current-buffer server-buffer erc-server-process))
161 (targets (erc-buffer-list
162 (lambda ()
163 (not (eq (process-buffer erc-server-process)
164 (current-buffer))))
165 proc)))
166 (when targets
167 (speedbar-with-writable
168 (dolist (target targets)
169 (erc-speedbar-insert-target target depth))
170 t)))))
171
172(defun erc-speedbar-insert-target (buffer depth)
173 (if (with-current-buffer buffer
174 (erc-channel-p (erc-default-target)))
175 (speedbar-make-tag-line
176 'bracket ?+ 'erc-speedbar-expand-channel buffer
177 (buffer-name buffer) 'erc-speedbar-goto-buffer buffer nil
178 depth)
179 ;; Query target
180 (speedbar-make-tag-line
181 nil nil nil nil
182 (buffer-name buffer) 'erc-speedbar-goto-buffer buffer nil
183 depth)))
184
185(defun erc-speedbar-expand-channel (text channel indent)
186 "For the line matching TEXT, in CHANNEL, expand or contract a line.
187INDENT is the current indentation level."
188 (cond
189 ((string-match "+" text)
190 (speedbar-change-expand-button-char ?-)
191 (speedbar-with-writable
192 (save-excursion
193 (end-of-line) (forward-char 1)
194 (let ((modes (with-current-buffer channel
195 (concat (apply 'concat
196 erc-channel-modes)
197 (cond
198 ((and erc-channel-user-limit
199 erc-channel-key)
200 (if erc-show-channel-key-p
201 (format "lk %.0f %s"
202 erc-channel-user-limit
203 erc-channel-key)
204 (format "kl %.0f" erc-channel-user-limit)))
205 (erc-channel-user-limit
206 ;; Emacs has no bignums
207 (format "l %.0f" erc-channel-user-limit))
208 (erc-channel-key
209 (if erc-show-channel-key-p
210 (format "k %s" erc-channel-key)
211 "k"))
212 (t "")))))
213 (topic (erc-controls-interpret
214 (with-current-buffer channel erc-channel-topic))))
215 (speedbar-make-tag-line
216 'angle ?i nil nil
217 (concat "Modes: +" modes) nil nil nil
218 (1+ indent))
219 (unless (string= topic "")
220 (speedbar-make-tag-line
221 'angle ?i nil nil
222 (concat "Topic: " topic) nil nil nil
223 (1+ indent)))
224 (let ((names (cond ((eq erc-speedbar-sort-users-type 'alphabetical)
225 (erc-sort-channel-users-alphabetically
226 (with-current-buffer channel
227 (erc-get-channel-user-list))))
228 ((eq erc-speedbar-sort-users-type 'activity)
229 (erc-sort-channel-users-by-activity
230 (with-current-buffer channel
231 (erc-get-channel-user-list))))
232 (t (with-current-buffer channel
233 (erc-get-channel-user-list))))))
234 (when names
235 (speedbar-with-writable
236 (dolist (entry names)
237 (erc-speedbar-insert-user entry ?+ (1+ indent))))))))))
238 ((string-match "-" text)
239 (speedbar-change-expand-button-char ?+)
240 (speedbar-delete-subblock indent))
241 (t (error "Ooops... not sure what to do")))
242 (speedbar-center-buffer-smartly))
243
244(defun erc-speedbar-insert-user (entry exp-char indent)
245 "Insert one user based on the channel member list ENTRY.
246EXP-CHAR is the expansion character to use.
247INDENT is the current indentation level."
248 (let* ((user (car entry))
249 (cuser (cdr entry))
250 (nick (erc-server-user-nickname user))
251 (host (erc-server-user-host user))
252 (info (erc-server-user-info user))
253 (login (erc-server-user-login user))
254 (name (erc-server-user-full-name user))
255 (voice (and cuser (erc-channel-user-voice cuser)))
256 (op (and cuser (erc-channel-user-op cuser)))
257 (nick-str (concat (if op "@" "") (if voice "+" "") nick))
258 (finger (concat login (when (or login host) "@") host))
259 (sbtoken (list finger name info)))
260 (if (or login host name info) ; we want to be expandable
261 (speedbar-make-tag-line
262 'bracket ?+ 'erc-speedbar-expand-user sbtoken
263 nick-str nil sbtoken nil
264 indent)
265 (when (equal exp-char ?-)
266 (forward-line -1)
267 (erc-speedbar-expand-user "+" (list finger name info) indent))
268 (speedbar-make-tag-line
269 'statictag ?? nil nil
270 nick-str nil nil nil
271 indent))))
272
273(defun erc-speedbar-update-channel (buffer)
274 "Update the speedbar information about a ERC buffer. The update
275is only done when the channel is actually expanded already."
276 ;; This is only a rude hack and doesn't care about multiserver usage
277 ;; yet, consider this a brain storming, better ideas?
278 (with-current-buffer speedbar-buffer
279 (save-excursion
280 (goto-char (point-min))
281 (when (re-search-forward (concat "^1: *.+. *"
282 (regexp-quote (buffer-name buffer)))
283 nil t)
284 (beginning-of-line)
285 (speedbar-delete-subblock 1)
286 (erc-speedbar-expand-channel "+" buffer 1)))))
287
288(defun erc-speedbar-expand-user (text token indent)
289 (cond ((string-match "+" text)
290 (speedbar-change-expand-button-char ?-)
291 (speedbar-with-writable
292 (save-excursion
293 (end-of-line) (forward-char 1)
294 (let ((finger (nth 0 token))
295 (name (nth 1 token))
296 (info (nth 2 token)))
297 (when finger
298 (speedbar-make-tag-line
299 nil nil nil nil
300 finger nil nil nil
301 (1+ indent)))
302 (when name
303 (speedbar-make-tag-line
304 nil nil nil nil
305 name nil nil nil
306 (1+ indent)))
307 (when info
308 (speedbar-make-tag-line
309 nil nil nil nil
310 info nil nil nil
311 (1+ indent)))))))
312 ((string-match "-" text)
313 (speedbar-change-expand-button-char ?+)
314 (speedbar-delete-subblock indent))
315 (t (error "Ooops... not sure what to do")))
316 (speedbar-center-buffer-smartly))
317
318(defun erc-speedbar-goto-buffer (text buffer indent)
319 "When user clicks on TEXT, goto an ERC buffer.
320The INDENT level is ignored."
321 (if (featurep 'dframe)
322 (progn
323 (dframe-select-attached-frame speedbar-frame)
324 (let ((bwin (get-buffer-window buffer 0)))
325 (if bwin
326 (progn
327 (select-window bwin)
328 (raise-frame (window-frame bwin)))
329 (if dframe-power-click
330 (let ((pop-up-frames t))
331 (select-window (display-buffer buffer)))
332 (dframe-select-attached-frame speedbar-frame)
333 (switch-to-buffer buffer)))))
334 (let ((bwin (get-buffer-window buffer 0)))
335 (if bwin
336 (progn
337 (select-window bwin)
338 (raise-frame (window-frame bwin)))
339 (if speedbar-power-click
340 (let ((pop-up-frames t)) (select-window (display-buffer buffer)))
341 (select-frame speedbar-attached-frame)
342 (switch-to-buffer buffer))))))
343
344(defun erc-speedbar-line-text ()
345 "Return the text for the item on the current line."
346 (beginning-of-line)
347 (when (re-search-forward "[]>] " nil t)
348 (buffer-substring-no-properties (point) (point-at-eol))))
349
350(defun erc-speedbar-item-info ()
351 "Display information about the current buffer on the current line."
352 (let ((data (speedbar-line-token))
353 (txt (erc-speedbar-line-text)))
354 (cond ((and data (listp data))
355 (message "%s: %s" txt (car data)))
356 ((bufferp data)
357 (message "Channel: %s" txt))
358 (t
359 (message "%s" txt)))))
360
361(provide 'erc-speedbar)
362;;; erc-speedbar.el ends here
363;;
364;; Local Variables:
365;; indent-tabs-mode: t
366;; tab-width: 8
367;; End:
368
369;; arch-tag: 7a6558a4-3308-4bf5-a284-e1d042c933c6
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
new file mode 100644
index 00000000000..dd9aad68f22
--- /dev/null
+++ b/lisp/erc/erc-spelling.el
@@ -0,0 +1,93 @@
1;;; erc-spelling.el --- use flyspell in ERC
2
3;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4
5;; Author: Jorgen Schaefer <forcer@forcix.cx>
6;; Keywords: irc
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcSpelling
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; This is an ERC module to enable flyspell mode in ERC buffers. This
29;; ensures correct behavior of flyspell, and even sets up a
30;; channel-local dictionary if so required.
31
32;;; Code:
33
34(require 'erc)
35(require 'flyspell)
36
37;;;###autoload (autoload 'erc-spelling-mode "erc-spelling" nil t)
38(define-erc-module spelling nil
39 "Enable flyspell mode in ERC buffers."
40 ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
41 ;; called AFTER the server buffer is initialized.
42 ((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
43 (mapc (lambda (buffer)
44 (with-current-buffer buffer (erc-spelling-init)))
45 (erc-buffer-list)))
46 ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
47 (mapc (lambda (buffer)
48 (with-current-buffer buffer (flyspell-mode 0)))
49 (erc-buffer-list))))
50
51(defcustom erc-spelling-dictionaries nil
52 "An alist mapping buffer names to dictionaries.
53The `car' of every cell is a buffer name, the `cadr' is the
54string name of an associated dictionary.
55The dictionary is inherited from server buffers, so if you want a
56default dictionary for some server, you can use a server buffer
57name here."
58 :type '(choice (const nil)
59 (repeat (cons (string :tag "Buffer name")
60 (string :tag "Dictionary"))))
61 :group 'erc-spelling)
62
63(defun erc-spelling-init ()
64 "Enable flyspell mode in an ERC buffer."
65 (let ((name (downcase (buffer-name)))
66 (dicts erc-spelling-dictionaries))
67 (while (and dicts
68 (not (string= name (downcase (caar dicts)))))
69 (setq dicts (cdr dicts)))
70 (setq ispell-local-dictionary
71 (if dicts
72 (cadr (car dicts))
73 (let ((server (erc-server-buffer)))
74 (if server
75 (with-current-buffer server
76 ispell-local-dictionary)
77 nil)))))
78 (setq flyspell-generic-check-word-p 'erc-spelling-flyspell-verify)
79 (flyspell-mode 1))
80
81(put 'erc-mode
82 'flyspell-mode-predicate
83 'erc-spelling-flyspell-verify)
84
85(defun erc-spelling-flyspell-verify ()
86 "Flyspell only the input line, nothing else."
87 (> (point)
88 erc-input-marker))
89
90(provide 'erc-spelling)
91
92;; arch-tag: 04ae1c46-0fd1-4e1a-8b80-55bfa471c945
93;;; erc-spelling.el ends here
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
new file mode 100644
index 00000000000..767839e343b
--- /dev/null
+++ b/lisp/erc/erc-stamp.el
@@ -0,0 +1,335 @@
1;;; erc-stamp.el --- Timestamping for Emacs IRC CLient
2
3;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm, processes, timestamp
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcStamp
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; The code contained in this module is responsible for inserting
29;; timestamps into ERC buffers. In order to actually activate this,
30;; you must call `erc-timestamp-mode'.
31
32;; You can choose between two different ways of inserting timestamps.
33;; Customize `erc-insert-timestamp-function' and
34;; `erc-insert-away-timestamp-function'.
35
36;;; Code:
37
38(require 'erc)
39(require 'erc-compat)
40
41(defgroup erc-stamp nil
42 "For long conversation on IRC it is sometimes quite
43useful to have individual messages timestamp. This
44group provides settings related to the format and display
45of timestamp information in `erc-mode' buffer.
46
47For timestamping to be activated, you just need to load `erc-stamp'
48in your .emacs file or interactively using `load-library'."
49 :group 'erc)
50
51(defcustom erc-timestamp-format "[%H:%M]"
52 "*If set to a string, messages will be timestamped.
53This string is processed using `format-time-string'.
54Good examples are \"%T\" and \"%H:%M\".
55
56If nil, timestamping is turned off."
57 :group 'erc-stamp
58 :type '(choice (const nil)
59 (string)))
60
61(defcustom erc-insert-timestamp-function 'erc-insert-timestamp-right
62 "*Function to use to insert timestamps.
63
64It takes a single argument STRING which is the final string
65which all text-properties already appended. This function only cares about
66inserting this string at the right position. Narrowing is in effect
67while it is called, so (point-min) and (point-max) determine the region to
68operate on."
69 :group 'erc-stamp
70 :type '(choice (const :tag "Right" erc-insert-timestamp-right)
71 (const :tag "Left" erc-insert-timestamp-left)
72 function))
73
74(defcustom erc-away-timestamp-format "<%H:%M>"
75 "*Timestamp format used when marked as being away.
76
77If nil, timestamping is turned off when away unless `erc-timestamp-format'
78is set.
79
80If `erc-timestamp-format' is set, this will not be used."
81 :group 'erc-stamp
82 :type '(choice (const nil)
83 (string)))
84
85(defcustom erc-insert-away-timestamp-function 'erc-insert-timestamp-right
86 "*Function to use to insert the away timestamp.
87
88See `erc-insert-timestamp-function' for details."
89 :group 'erc-stamp
90 :type '(choice (const :tag "Right" erc-insert-timestamp-right)
91 (const :tag "Left" erc-insert-timestamp-left)
92 function))
93
94(defcustom erc-hide-timestamps nil
95 "*If non-nil, timestamps will be invisible.
96
97This is useful for logging, because, although timestamps will be
98hidden, they will still be present in the logs."
99 :group 'erc-stamp
100 :type 'boolean)
101
102(defcustom erc-echo-timestamps nil
103 "*If non-nil, print timestamp in the minibuffer when point is moved.
104Using this variable, you can turn off normal timestamping,
105and simply move point to an irc message to see its timestamp
106printed in the minibuffer."
107 :group 'erc-stamp
108 :type 'boolean)
109
110(defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S"
111 "*Format string to be used when `erc-echo-timestamps' is non-nil.
112This string specifies the format of the timestamp being echoed in
113the minibuffer."
114 :group 'erc-stamp
115 :type 'string)
116
117(defcustom erc-timestamp-intangible t
118 "*Whether the timestamps should be intangible, i.e. prevent the point
119from entering them and instead jump over them."
120 :group 'erc-stamp
121 :type 'boolean)
122
123(defface erc-timestamp-face '((t (:bold t :foreground "green")))
124 "ERC timestamp face."
125 :group 'erc-faces)
126
127;;;###autoload (autoload 'erc-timestamp-mode "erc-stamp" nil t)
128(define-erc-module stamp timestamp
129 "This mode timestamps messages in the channel buffers."
130 ((add-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
131 (add-hook 'erc-insert-modify-hook 'erc-add-timestamp t)
132 (add-hook 'erc-send-modify-hook 'erc-add-timestamp t))
133 ((remove-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
134 (remove-hook 'erc-insert-modify-hook 'erc-add-timestamp)
135 (remove-hook 'erc-send-modify-hook 'erc-add-timestamp)))
136
137(defun erc-add-timestamp ()
138 "Add timestamp and text-properties to message.
139
140This function is meant to be called from `erc-insert-modify-hook'
141or `erc-send-modify-hook'."
142 (unless (get-text-property (point) 'invisible)
143 (let ((ct (current-time)))
144 (if (fboundp erc-insert-timestamp-function)
145 (funcall erc-insert-timestamp-function
146 (erc-format-timestamp ct erc-timestamp-format))
147 (error "Timestamp function unbound"))
148 (when (and (fboundp erc-insert-away-timestamp-function)
149 erc-away-timestamp-format
150 (with-current-buffer (erc-server-buffer) erc-away)
151 (not erc-timestamp-format))
152 (funcall erc-insert-away-timestamp-function
153 (erc-format-timestamp ct erc-away-timestamp-format)))
154 (add-text-properties (point-min) (point-max)
155 (list 'timestamp ct))
156 (add-text-properties (point-min) (point-max)
157 (list 'point-entered 'erc-echo-timestamp)))))
158
159(defvar erc-timestamp-last-inserted nil
160 "Last timestamp inserted into the buffer.")
161(make-variable-buffer-local 'erc-timestamp-last-inserted)
162
163(defcustom erc-timestamp-only-if-changed-flag t
164 "*Insert timestamp only if its value changed since last insertion.
165If `erc-insert-timestamp-function' is `erc-insert-timestamp-left', a
166string of spaces which is the same size as the timestamp is added to
167the beginning of the line in its place. If you use
168`erc-insert-timestamp-right', nothing gets inserted in place of the
169timestamp."
170 :group 'erc-stamp
171 :type 'boolean)
172
173(defcustom erc-timestamp-right-column nil
174 "*If non-nil, the column at which the timestamp is inserted,
175if the timestamp is to be printed to the right. If nil,
176`erc-insert-timestamp-right' will use other means to determine
177the correct column."
178 :group 'erc-stamp
179 :type '(choice
180 (integer :tag "Column number")
181 (const :tag "Unspecified" nil)))
182
183(defun erc-insert-timestamp-left (string)
184 "Insert timestamps at the beginning of the line."
185 (goto-char (point-min))
186 (let* ((ignore-p (and erc-timestamp-only-if-changed-flag
187 (string-equal string erc-timestamp-last-inserted)))
188 (len (length string))
189 (s (if ignore-p (make-string len ? ) string)))
190 (unless ignore-p (setq erc-timestamp-last-inserted string))
191 (erc-put-text-property 0 len 'field 'erc-timestamp s)
192 (insert s)))
193
194(defun erc-insert-aligned (string pos &optional fallback)
195 "Insert STRING based on a fraction of the width of the buffer.
196Fraction is roughly (/ POS (window-width)).
197
198If the current version of Emacs doesn't support this, use
199\(- POS FALLBACK) to determine how many spaces to insert."
200 (if (or (featurep 'xemacs)
201 (< emacs-major-version 22)
202 (not (eq window-system 'x)))
203 (insert (make-string (- pos fallback) ? ) string)
204 (insert " ")
205 (let ((offset (floor (* (/ (1- pos) (window-width) 1.0)
206 (nth 2 (window-inside-pixel-edges))))))
207 (put-text-property (1- (point)) (point) 'display
208 `(space :align-to (,offset))))
209 (insert string)))
210
211(defun erc-insert-timestamp-right (string)
212 "Insert timestamp on the right side of the screen.
213STRING is the timestamp to insert. The function is a possible value
214for `erc-insert-timestamp-function'.
215
216If `erc-timestamp-only-if-changed-flag' is nil, a timestamp is always
217printed. If this variable is non-nil, a timestamp is only printed if
218it is different from the last.
219
220If `erc-timestamp-right-column' is set, its value will be used as the
221column at which the timestamp is to be printed. If it is nil, and
222`erc-fill-mode' is active, then the timestamp will be printed just
223before `erc-fill-column'. Otherwise, if the current buffer is
224shown in a window, that window's width is used. If the buffer is
225not shown, and `fill-column' is set, then the timestamp will be
226printed just `fill-column'. As a last resort, the timestamp will
227be printed just before the window-width."
228 (unless (and erc-timestamp-only-if-changed-flag
229 (string-equal string erc-timestamp-last-inserted))
230 (setq erc-timestamp-last-inserted string)
231 (goto-char (point-max))
232 (forward-char -1);; before the last newline
233 (let* ((current-window (get-buffer-window (current-buffer)))
234 (pos (cond
235 (erc-timestamp-right-column
236 (+ erc-timestamp-right-column (length string)))
237 ((and (boundp 'erc-fill-mode)
238 erc-fill-mode
239 (boundp 'erc-fill-column))
240 (1+ erc-fill-column))
241 (current-window
242 (- (window-width current-window)
243 1))
244 (fill-column
245 (1+ fill-column))
246 (t
247 (- (window-width)
248 1))))
249 (from (point))
250 (col (current-column))
251 indent)
252 ;; deal with variable-width characters
253 (setq pos (- pos (string-width string))
254 ;; the following is a kludge that works with most
255 ;; international input
256 col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6))))
257 (if (< col pos)
258 (erc-insert-aligned string pos col)
259 (newline)
260 (setq from (point))
261 (indent-to pos)
262 (insert string))
263 (erc-put-text-property from (1+ (point)) 'field 'erc-timestamp)
264 (erc-put-text-property from (1+ (point)) 'rear-nonsticky t)
265 (when erc-timestamp-intangible
266 (erc-put-text-property from (1+ (point)) 'intangible t)))))
267
268;; for testing: (setq erc-timestamp-only-if-changed-flag nil)
269
270(defun erc-format-timestamp (time format)
271 "Return TIME formatted as string according to FORMAT.
272Return the empty string if FORMAT is nil."
273 (if format
274 (let ((ts (format-time-string format time)))
275 (erc-put-text-property 0 (length ts) 'face 'erc-timestamp-face ts)
276 (erc-put-text-property 0 (length ts) 'invisible 'timestamp ts)
277 (erc-put-text-property 0 (length ts)
278 'isearch-open-invisible 'timestamp ts)
279 ;; N.B. Later use categories instead of this harmless, but
280 ;; inelegant, hack. -- BPT
281 (when erc-timestamp-intangible
282 (erc-put-text-property 0 (length ts) 'intangible t ts))
283 ts)
284 ""))
285
286;; This function is used to munge `buffer-invisibility-spec to an
287;; appropriate value. Currently, it only handles timestamps, thus its
288;; location. If you add other features which affect invisibility,
289;; please modify this function and move it to a more appropriate
290;; location.
291(defun erc-munge-invisibility-spec ()
292 (if erc-hide-timestamps
293 (setq buffer-invisibility-spec
294 (if (listp buffer-invisibility-spec)
295 (cons 'timestamp buffer-invisibility-spec)
296 (list 't 'timestamp)))
297 (setq buffer-invisibility-spec
298 (if (listp buffer-invisibility-spec)
299 (remove 'timestamp buffer-invisibility-spec)
300 (list 't)))))
301
302(defun erc-hide-timestamps ()
303 "Hide timestamp information from display."
304 (interactive)
305 (setq erc-hide-timestamps t)
306 (erc-munge-invisibility-spec))
307
308(defun erc-show-timestamps ()
309 "Show timestamp information on display.
310This function only works if `erc-timestamp-format' was previously
311set, and timestamping is already active."
312 (interactive)
313 (setq erc-hide-timestamps nil)
314 (erc-munge-invisibility-spec))
315
316(defun erc-echo-timestamp (before now)
317 "Print timestamp text-property of an IRC message.
318Argument BEFORE is where point was before it got moved and
319NOW is position of point currently."
320 (when erc-echo-timestamps
321 (let ((stamp (get-text-property now 'timestamp)))
322 (when stamp
323 (message (format-time-string erc-echo-timestamp-format
324 stamp))))))
325
326(provide 'erc-stamp)
327
328;;; erc-stamp.el ends here
329;;
330;; Local Variables:
331;; indent-tabs-mode: t
332;; tab-width: 8
333;; End:
334
335;; arch-tag: 9f6d31bf-61ba-45c5-bdbf-56331486ea27
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
new file mode 100644
index 00000000000..6d760d75ba2
--- /dev/null
+++ b/lisp/erc/erc-track.el
@@ -0,0 +1,839 @@
1;;; erc-track.el --- Track modified channel buffers
2
3;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm, faces
7;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcChannelTracking
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; Highlights keywords and pals (friends), and hides or highlights fools
29;; (using a dark color). Add to your ~/.emacs:
30
31;; (require 'erc-track)
32;; (erc-track-mode 1)
33
34;; Todo:
35;; * Add extensibility so that custom functions can track
36;; custom modification types.
37
38(eval-when-compile (require 'cl))
39(require 'erc)
40(require 'erc-compat)
41(require 'erc-match)
42
43;;; Code:
44
45(defgroup erc-track nil
46 "Track active buffers and show activity in the modeline."
47 :group 'erc)
48
49(defcustom erc-track-visibility t
50 "Where do we look for buffers to determine their visibility?
51The value of this variable determines, when a buffer is considered
52visible or invisible. New messages in invisible buffers are tracked,
53while switching to visible buffers when they are tracked removes them
54from the list. See also `erc-track-when-inactive-mode'.
55
56Possible values are:
57
58t - all frames
59visible - all visible frames
60nil - only the selected frame
61selected-visible - only the selected frame if it is visible
62
63Activity means that there was no user input in the last 10 seconds."
64 :group 'erc-track
65 :type '(choice (const :tag "All frames" t)
66 (const :tag "All visible frames" visible)
67 (const :tag "Only the selected frame" nil)
68 (const :tag "Only the selected frame if it was active"
69 active)))
70
71(defcustom erc-track-exclude nil
72 "A list targets (channel names or query targets) which should not be tracked."
73 :group 'erc-track
74 :type '(repeat string))
75
76(defcustom erc-track-exclude-types '("NICK")
77 "*List of message types to be ignored.
78This list could look like '(\"JOIN\" \"PART\")."
79 :group 'erc-track
80 :type 'erc-message-type)
81
82(defcustom erc-track-exclude-server-buffer nil
83 "*If true, don't perform tracking on the server buffer; this is
84useful for excluding all the things like MOTDs from the server and
85other miscellaneous functions."
86 :group 'erc-track
87 :type 'boolean)
88
89(defcustom erc-track-shorten-start 1
90 "This number specifies the minimum number of characters a channel name in
91the mode-line should be reduced to."
92 :group 'erc-track
93 :type 'number)
94
95(defcustom erc-track-shorten-cutoff 4
96 "All channel names longer than this value will be shortened."
97 :group 'erc-track
98 :type 'number)
99
100(defcustom erc-track-shorten-aggressively nil
101 "*If non-nil, channel names will be shortened more aggressively.
102Usually, names are not shortened if this will save only one character.
103Example: If there are two channels, #linux-de and #linux-fr, then
104normally these will not be shortened. When shortening aggressively,
105however, these will be shortened to #linux-d and #linux-f.
106
107If this variable is set to `max', then channel names will be shortened
108to the max. Usually, shortened channel names will remain unique for a
109given set of existing channels. When shortening to the max, the shortened
110channel names will be unique for the set of active channels only.
111Example: If there are tow active channels #emacs and #vi, and two inactive
112channels #electronica and #folk, then usually the active channels are
113shortened to #em and #v. When shortening to the max, however, #emacs is
114not compared to #electronica -- only to #vi, therefore it can be shortened
115even more and the result is #e and #v.
116
117This setting is used by `erc-track-shorten-names'."
118 :group 'erc-track
119 :type '(choice (const :tag "No" nil)
120 (const :tag "Yes" t)
121 (const :tag "Max" max)))
122
123(defcustom erc-track-shorten-function 'erc-track-shorten-names
124 "*This function will be used to reduce the channel names before display.
125It takes one argument, CHANNEL-NAMES which is a list of strings.
126It should return a list of strings of the same number of elements.
127If nil instead of a function, shortening is disabled."
128 :group 'erc-track
129 :type '(choice (const :tag "Disabled")
130 function))
131
132(defcustom erc-track-use-faces t
133 "*Use faces in the mode-line.
134The faces used are the same as used for text in the buffers.
135\(e.g. `erc-pal-face' is used if a pal sent a message to that channel.)"
136 :group 'erc-track
137 :type 'boolean)
138
139(defcustom erc-track-faces-priority-list
140 '(erc-error-face erc-current-nick-face erc-keyword-face erc-pal-face
141 erc-nick-msg-face erc-direct-msg-face erc-button erc-dangerous-host-face
142 erc-default-face erc-action-face erc-nick-default-face erc-fool-face
143 erc-notice-face erc-input-face erc-prompt-face)
144 "A list of faces used to highlight active buffer names in the modeline.
145If a message contains one of the faces in this list, the buffer name will
146be highlighted using that face. The first matching face is used."
147 :group 'erc-track
148 :type '(repeat face))
149
150(defcustom erc-track-priority-faces-only nil
151 "Only track text highlighted with a priority face.
152If you would like to ignore changes in certain channels where there
153are no faces corresponding to your `erc-track-faces-priority-list', set
154this variable. You can set a list of channel name strings, so those
155will be ignored while all other channels will be tracked as normal.
156Other options are 'all, to apply this to all channels or nil, to disable
157this feature.
158Note: If you have a lot of faces listed in `erc-track-faces-priority-list',
159setting this variable might not be very useful."
160 :group 'erc-track
161 :type '(choice (const nil)
162 (repeat string)
163 (const all)))
164
165(defcustom erc-track-position-in-mode-line 'before-modes
166 "Where to show modified channel information in the mode-line.
167
168Setting this variable only has effects in GNU Emacs versions above 21.3.
169
170Choices are:
171'before-modes - add to the beginning of `mode-line-modes'
172'after-modes - add to the end of `mode-line-modes'
173
174Any other value means add to the end of `global-mode-string'."
175 :group 'erc-track
176 :type '(choice (const :tag "Just before mode information" before-modes)
177 (const :tag "Just after mode information" after-modes)
178 (const :tag "After all other information" nil))
179 :set (lambda (sym val)
180 (set sym val)
181 (when (and (boundp 'erc-track-mode)
182 erc-track-mode)
183 (erc-track-remove-from-mode-line)
184 (erc-track-add-to-mode-line val))))
185
186(defun erc-modified-channels-object (strings)
187 "Generate a new `erc-modified-channels-object' based on STRINGS.
188If STRINGS is nil, we initialize `erc-modified-channels-object' to
189an appropriate initial value for this flavor of Emacs."
190 (if strings
191 (if (featurep 'xemacs)
192 (let ((e-m-c-s '("[")))
193 (push (cons (extent-at 0 (car strings)) (car strings))
194 e-m-c-s)
195 (dolist (string (cdr strings))
196 (push "," e-m-c-s)
197 (push (cons (extent-at 0 string) string)
198 e-m-c-s))
199 (push "] " e-m-c-s)
200 (reverse e-m-c-s))
201 (concat (if (eq erc-track-position-in-mode-line 'after-modes)
202 "[" " [")
203 (mapconcat 'identity (nreverse strings) ",")
204 (if (eq erc-track-position-in-mode-line 'before-modes)
205 "] " "]")))
206 (if (featurep 'xemacs) '() "")))
207
208(defvar erc-modified-channels-object (erc-modified-channels-object nil)
209 "Internal object used for displaying modified channels in the mode line.")
210
211(put 'erc-modified-channels-object 'risky-local-variable t); allow properties
212
213(defvar erc-modified-channels-alist nil
214 "An ALIST used for tracking channel modification activity.
215Each element looks like (BUFFER COUNT FACE) where BUFFER is a buffer
216object of the channel the entry corresponds to, COUNT is a number
217indicating how often activity was noticed, and FACE is the face to use
218when displaying the buffer's name. See `erc-track-faces-priority-list',
219and `erc-track-showcount'.
220
221Entries in this list should only happen for buffers where activity occurred
222while the buffer was not visible.")
223
224(defcustom erc-track-showcount nil
225 "If non-nil, count of unseen messages will be shown for each channel."
226 :type 'boolean
227 :group 'erc-track)
228
229(defcustom erc-track-showcount-string ":"
230 "The string to display between buffer name and the count in the mode line.
231The default is a colon, resulting in \"#emacs:9\"."
232 :type 'string
233 :group 'erc-track)
234
235(defcustom erc-track-switch-from-erc t
236 "If non-nil, `erc-track-switch-buffer' will return to the last non-erc buffer
237when there are no more active channels."
238 :type 'boolean
239 :group 'erc-track)
240
241(defcustom erc-track-switch-direction 'oldest
242 "Direction `erc-track-switch-buffer' should switch.
243
244 oldest - find oldest active buffer
245 newest - find newest active buffer
246 leastactive - find buffer with least unseen messages
247 mostactive - find buffer with most unseen messages."
248 :group 'erc-track
249 :type '(choice (const oldest)
250 (const newest)
251 (const leastactive)
252 (const mostactive)))
253
254
255(defun erc-track-remove-from-mode-line ()
256 "Remove `erc-track-modified-channels' from the mode-line"
257 (when (boundp 'mode-line-modes)
258 (setq mode-line-modes
259 (remove '(t erc-modified-channels-object) mode-line-modes)))
260 (when (consp global-mode-string)
261 (setq global-mode-string
262 (delq 'erc-modified-channels-object global-mode-string))))
263
264(defun erc-track-add-to-mode-line (position)
265 "Add `erc-track-modified-channels' to POSITION in the mode-line.
266See `erc-track-position-in-mode-line' for possible values."
267 ;; CVS Emacs has a new format string, and global-mode-string
268 ;; is very far to the right.
269 (cond ((and (eq position 'before-modes)
270 (boundp 'mode-line-modes))
271 (add-to-list 'mode-line-modes
272 '(t erc-modified-channels-object)))
273 ((and (eq position 'after-modes)
274 (boundp 'mode-line-modes))
275 (add-to-list 'mode-line-modes
276 '(t erc-modified-channels-object) t))
277 (t
278 (when (not global-mode-string)
279 (setq global-mode-string '(""))) ; Padding for mode-line wart
280 (add-to-list 'global-mode-string
281 'erc-modified-channels-object
282 t))))
283
284;;; Shortening of names
285
286(defun erc-track-shorten-names (channel-names)
287 "Call `erc-unique-channel-names' with the correct parameters.
288This function is a good value for `erc-track-shorten-function'.
289The list of all channels is returned by `erc-all-buffer-names'.
290CHANNEL-NAMES is the list of active channel names.
291Only channel names longer than `erc-track-shorten-cutoff' are
292actually shortened, and they are only shortened to a minimum
293of `erc-track-shorten-start' characters."
294 (erc-unique-channel-names
295 (erc-all-buffer-names)
296 channel-names
297 (lambda (s)
298 (> (length s) erc-track-shorten-cutoff))
299 erc-track-shorten-start))
300
301(defvar erc-default-recipients)
302
303(defun erc-all-buffer-names ()
304 "Return all channel or query buffer names.
305Note that we cannot use `erc-channel-list' with a nil argument,
306because that does not return query buffers."
307 (save-excursion
308 (let (result)
309 (dolist (buf (buffer-list))
310 (set-buffer buf)
311 (when (or (eq major-mode 'erc-mode) (eq major-mode 'erc-dcc-chat-mode))
312 (setq result (cons (buffer-name) result))))
313 result)))
314
315(defun erc-unique-channel-names (all active &optional predicate start)
316 "Return a list of unique channel names.
317ALL is the list of all channel and query buffer names.
318ACTIVE is the list of active buffer names.
319PREDICATE is a predicate that should return non-nil if a name needs
320 no shortening.
321START is the minimum length of the name used."
322 (if (eq 'max erc-track-shorten-aggressively)
323 ;; Return the unique substrings of all active channels.
324 (erc-unique-substrings active predicate start)
325 ;; Otherwise, determine the unique substrings of all channels, and
326 ;; for every active channel, return the corresponding substring.
327 ;; Given the names of the active channels, we now need to find the
328 ;; corresponding short name from the list of all substrings. To
329 ;; avoid problems when there are two channels and one is a
330 ;; substring of the other (notorious examples are #hurd and
331 ;; #hurd-bunny), every candidate gets the longest possible
332 ;; substring.
333 (let ((all-substrings (sort
334 (erc-unique-substrings all predicate start)
335 (lambda (a b) (> (length a) (length b)))))
336 result)
337 (dolist (channel active)
338 (let ((substrings all-substrings)
339 candidate
340 winner)
341 (while (and substrings (not winner))
342 (setq candidate (car substrings)
343 substrings (cdr substrings))
344 (when (and (string= candidate
345 (substring channel
346 0
347 (min (length candidate)
348 (length channel))))
349 (not (member candidate result)))
350 (setq winner candidate)))
351 (setq result (cons winner result))))
352 (nreverse result))))
353
354(defun erc-unique-substrings (strings &optional predicate start)
355 "Return a list of unique substrings of STRINGS."
356 (if (or (not (numberp start))
357 (< start 0))
358 (setq start 2))
359 (mapcar
360 (lambda (str)
361 (let* ((others (delete str (copy-sequence strings)))
362 (maxlen (length str))
363 (i (min start
364 (length str)))
365 candidate
366 done)
367 (if (and (functionp predicate) (not (funcall predicate str)))
368 ;; do not shorten if a predicate exists and it returns nil
369 str
370 ;; Start with smallest substring candidate, ie. length 1.
371 ;; Then check all the others and see whether any of them starts
372 ;; with the same substring. While there is such another
373 ;; element in the list, increase the length of the candidate.
374 (while (not done)
375 (if (> i maxlen)
376 (setq done t)
377 (setq candidate (substring str 0 i)
378 done (not (erc-unique-substring-1 candidate others))))
379 (setq i (1+ i)))
380 (if (and (= (length candidate) (1- maxlen))
381 (not erc-track-shorten-aggressively))
382 str
383 candidate))))
384 strings))
385
386(defun erc-unique-substring-1 (candidate others)
387 "Return non-nil when any string in OTHERS starts with CANDIDATE."
388 (let (result other (maxlen (length candidate)))
389 (while (and others
390 (not result))
391 (setq other (car others)
392 others (cdr others))
393 (when (and (>= (length other) maxlen)
394 (string= candidate (substring other 0 maxlen)))
395 (setq result other)))
396 result))
397
398;;; Test:
399
400(erc-assert
401 (and
402 ;; verify examples from the doc strings
403 (equal (let ((erc-track-shorten-aggressively nil))
404 (erc-unique-channel-names
405 '("#emacs" "#vi" "#electronica" "#folk")
406 '("#emacs" "#vi")))
407 '("#em" "#vi")) ; emacs is different from electronica
408 (equal (let ((erc-track-shorten-aggressively t))
409 (erc-unique-channel-names
410 '("#emacs" "#vi" "#electronica" "#folk")
411 '("#emacs" "#vi")))
412 '("#em" "#v")) ; vi is shortened by one letter
413 (equal (let ((erc-track-shorten-aggressively 'max))
414 (erc-unique-channel-names
415 '("#emacs" "#vi" "#electronica" "#folk")
416 '("#emacs" "#vi")))
417 '("#e" "#v")) ; emacs need not be different from electronica
418 (equal (let ((erc-track-shorten-aggressively nil))
419 (erc-unique-channel-names
420 '("#linux-de" "#linux-fr")
421 '("#linux-de" "#linux-fr")))
422 '("#linux-de" "#linux-fr")) ; shortening by one letter is too aggressive
423 (equal (let ((erc-track-shorten-aggressively t))
424 (erc-unique-channel-names
425 '("#linux-de" "#linux-fr")
426 '("#linux-de" "#linux-fr")))
427 '("#linux-d" "#linux-f")); now we want to be aggressive
428 ;; specific problems
429 (equal (let ((erc-track-shorten-aggressively nil))
430 (erc-unique-channel-names
431 '("#dunnet" "#lisp" "#sawfish" "#fsf" "#guile"
432 "#testgnome" "#gnu" "#fsbot" "#hurd" "#hurd-bunny"
433 "#emacs")
434 '("#hurd-bunny" "#hurd" "#sawfish" "#lisp")))
435 '("#hurd-" "#hurd" "#s" "#l"))
436 (equal (let ((erc-track-shorten-aggressively nil))
437 (erc-unique-substrings
438 '("#emacs" "#vi" "#electronica" "#folk")))
439 '("#em" "#vi" "#el" "#f"))
440 (equal (let ((erc-track-shorten-aggressively t))
441 (erc-unique-substrings
442 '("#emacs" "#vi" "#electronica" "#folk")))
443 '("#em" "#v" "#el" "#f"))
444 (equal (let ((erc-track-shorten-aggressively nil))
445 (erc-unique-channel-names
446 '("#emacs" "#burse" "+linux.de" "#starwars"
447 "#bitlbee" "+burse" "#ratpoison")
448 '("+linux.de" "#starwars" "#burse")))
449 '("+l" "#s" "#bu"))
450 (equal (let ((erc-track-shorten-aggressively nil))
451 (erc-unique-channel-names
452 '("fsbot" "#emacs" "deego")
453 '("fsbot")))
454 '("fs"))
455 (equal (let ((erc-track-shorten-aggressively nil))
456 (erc-unique-channel-names
457 '("fsbot" "#emacs" "deego")
458 '("fsbot")
459 (lambda (s)
460 (> (length s) 4))
461 1))
462 '("f"))
463 (equal (let ((erc-track-shorten-aggressively nil))
464 (erc-unique-channel-names
465 '("fsbot" "#emacs" "deego")
466 '("fsbot")
467 (lambda (s)
468 (> (length s) 4))
469 2))
470 '("fs"))
471 (let ((erc-track-shorten-aggressively nil))
472 (equal (erc-unique-channel-names '("deego" "#hurd" "#hurd-bunny" "#emacs")
473 '("#hurd" "#hurd-bunny"))
474 '("#hurd" "#hurd-")))
475 ;; general examples
476 (let ((erc-track-shorten-aggressively t))
477 (and (equal (erc-unique-substring-1 "abc" '("ab" "abcd")) "abcd")
478 (not (erc-unique-substring-1 "a" '("xyz" "xab")))
479 (equal (erc-unique-substrings '("abc" "xyz" "xab"))
480 '("ab" "xy" "xa"))
481 (equal (erc-unique-substrings '("abc" "abcdefg"))
482 '("abc" "abcd"))))
483 (let ((erc-track-shorten-aggressively nil))
484 (and (equal (erc-unique-substring-1 "abc" '("ab" "abcd")) "abcd")
485 (not (erc-unique-substring-1 "a" '("xyz" "xab")))
486 (equal (erc-unique-substrings '("abc" "xyz" "xab"))
487 '("abc" "xyz" "xab"))
488 (equal (erc-unique-substrings '("abc" "abcdefg"))
489 '("abc" "abcd"))))))
490
491;;; Module
492
493;;;###autoload (autoload 'erc-track-mode "erc-track" nil t)
494(define-erc-module track track-modified-channels
495 "This mode tracks ERC channel buffers with activity."
496 ((erc-track-add-to-mode-line erc-track-position-in-mode-line)
497 (setq erc-modified-channels-object (erc-modified-channels-object nil))
498 (erc-update-mode-line)
499 (if (featurep 'xemacs)
500 (defadvice switch-to-buffer (after erc-update (&rest args) activate)
501 (erc-modified-channels-update))
502 (add-hook 'window-configuration-change-hook 'erc-modified-channels-update))
503 (add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
504 (add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
505 ((erc-track-remove-from-mode-line)
506 (if (featurep 'xemacs)
507 (ad-disable-advice 'switch-to-buffer 'after 'erc-update)
508 (remove-hook 'window-configuration-change-hook
509 'erc-modified-channels-update))
510 (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
511 (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)))
512
513;;;###autoload (autoload 'erc-track-when-inactive-mode "erc-track" nil t)
514(define-erc-module track-when-inactive nil
515 "This mode enables channel tracking even for visible buffers,
516if you are inactivity."
517 ((if (featurep 'xemacs)
518 (defadvice switch-to-buffer (after erc-update-when-inactive (&rest args) activate)
519 (erc-user-is-active))
520 (add-hook 'window-configuration-change-hook 'erc-user-is-active))
521 (add-hook 'erc-send-completed-hook 'erc-user-is-active)
522 (add-hook 'erc-server-001-functions 'erc-user-is-active))
523 ((erc-track-remove-from-mode-line)
524 (if (featurep 'xemacs)
525 (ad-disable-advice 'switch-to-buffer 'after 'erc-update-when-inactive)
526 (remove-hook 'window-configuration-change-hook 'erc-user-is-active))
527 (remove-hook 'erc-send-completed-hook 'erc-user-is-active)
528 (remove-hook 'erc-server-001-functions 'erc-user-is-active)
529 (remove-hook 'erc-timer-hook 'erc-user-is-active)))
530
531;;; Visibility
532
533(defvar erc-buffer-activity nil
534 "Last time the user sent something.")
535
536(defvar erc-buffer-activity-timeout 10
537 "How many seconds of inactivity by the user
538to consider when `erc-track-visibility' is set to
539only consider active buffers visible.")
540
541(defun erc-user-is-active (&rest ignore)
542 "Set `erc-buffer-activity'."
543 (setq erc-buffer-activity (erc-current-time))
544 (erc-track-modified-channels))
545
546(defun erc-buffer-visible (buffer)
547 "Return non-nil when the buffer is visible."
548 (if erc-track-when-inactive-mode
549 (when erc-buffer-activity; could be nil
550 (and (get-buffer-window buffer erc-track-visibility)
551 (<= (erc-time-diff erc-buffer-activity (erc-current-time))
552 erc-buffer-activity-timeout)))
553 (get-buffer-window buffer erc-track-visibility)))
554
555;;; Tracking the channel modifications
556
557(defvar erc-modified-channels-update-inside nil
558 "Variable to prevent running `erc-modified-channels-update' multiple
559times. Without it, you cannot debug `erc-modified-channels-display',
560because the debugger also cases changes to the window-configuration.")
561
562(defun erc-modified-channels-update (&rest args)
563 "This function updates the information in `erc-modified-channels-alist'
564according to buffer visibility. It calls
565`erc-modified-channels-display' at the end. This should usually be
566called via `window-configuration-change-hook'.
567ARGS are ignored."
568 (interactive)
569 (unless erc-modified-channels-update-inside
570 (let ((erc-modified-channels-update-inside t))
571 (mapcar (lambda (elt)
572 (let ((buffer (car elt)))
573 (when (or (not (bufferp buffer))
574 (not (buffer-live-p buffer))
575 (erc-buffer-visible buffer)
576 (not (with-current-buffer buffer
577 erc-server-connected)))
578 (erc-modified-channels-remove-buffer buffer))))
579 erc-modified-channels-alist)
580 (erc-modified-channels-display)
581 (force-mode-line-update t))))
582
583(defun erc-make-mode-line-buffer-name (string buffer &optional faces count)
584 "Return STRING as a button that switches to BUFFER when clicked.
585If FACES are provided, color STRING with them."
586 ;; We define a new sparse keymap every time, because 1. this data
587 ;; structure is very small, the alternative would require us to
588 ;; defvar a keymap, 2. the user is not interested in customizing it
589 ;; (really?), 3. the defun needs to switch to BUFFER, so we would
590 ;; need to save that value somewhere.
591 (let ((map (make-sparse-keymap))
592 (name (if erc-track-showcount
593 (concat string
594 erc-track-showcount-string
595 (int-to-string count))
596 (copy-sequence string))))
597 (define-key map (vector 'mode-line 'mouse-2)
598 `(lambda (e)
599 (interactive "e")
600 (save-selected-window
601 (select-window
602 (posn-window (event-start e)))
603 (switch-to-buffer ,buffer))))
604 (define-key map (vector 'mode-line 'mouse-3)
605 `(lambda (e)
606 (interactive "e")
607 (save-selected-window
608 (select-window
609 (posn-window (event-start e)))
610 (switch-to-buffer-other-window ,buffer))))
611 (put-text-property 0 (length name) 'local-map map name)
612 (when (and faces erc-track-use-faces)
613 (put-text-property 0 (length name) 'face faces name))
614 name))
615
616(defun erc-modified-channels-display ()
617 "Set `erc-modified-channels-object'
618according to `erc-modified-channels-alist'.
619Use `erc-make-mode-line-buffer-name' to create buttons."
620 (if (or
621 (eq 'mostactive erc-track-switch-direction)
622 (eq 'leastactive erc-track-switch-direction))
623 (erc-track-sort-by-activest))
624 (if (null erc-modified-channels-alist)
625 (setq erc-modified-channels-object (erc-modified-channels-object nil))
626 ;; erc-modified-channels-alist contains all the data we need. To
627 ;; better understand what is going on, we split things up into
628 ;; four lists: BUFFERS, COUNTS, SHORT-NAMES, and FACES. These
629 ;; four lists we use to create a new
630 ;; `erc-modified-channels-object' using
631 ;; `erc-make-mode-line-buffer-name'.
632 (let* ((buffers (mapcar 'car erc-modified-channels-alist))
633 (counts (mapcar 'cadr erc-modified-channels-alist))
634 (faces (mapcar 'cddr erc-modified-channels-alist))
635 (long-names (mapcar #'(lambda (buf)
636 (or (buffer-name buf)
637 ""))
638 buffers))
639 (short-names (if (functionp erc-track-shorten-function)
640 (funcall erc-track-shorten-function
641 long-names)
642 long-names))
643 strings)
644 (while buffers
645 (when (car short-names)
646 (setq strings (cons (erc-make-mode-line-buffer-name
647 (car short-names)
648 (car buffers)
649 (car faces)
650 (car counts))
651 strings)))
652 (setq short-names (cdr short-names)
653 buffers (cdr buffers)
654 counts (cdr counts)
655 faces (cdr faces)))
656 (when (featurep 'xemacs)
657 (erc-modified-channels-object nil))
658 (setq erc-modified-channels-object
659 (erc-modified-channels-object strings)))))
660
661(defun erc-modified-channels-remove-buffer (buffer)
662 "Remove BUFFER from `erc-modified-channels-alist'."
663 (interactive "bBuffer: ")
664 (setq erc-modified-channels-alist
665 (delete (assq buffer erc-modified-channels-alist)
666 erc-modified-channels-alist))
667 (when (interactive-p)
668 (erc-modified-channels-display)))
669
670(defun erc-track-find-face (faces)
671 "Return the face to use in the modeline from the faces in FACES.
672If `erc-track-faces-priority-list' is set, the one from FACES who is
673first in that list will be used."
674 (let ((candidates erc-track-faces-priority-list)
675 candidate face)
676 (while (and candidates (not face))
677 (setq candidate (car candidates)
678 candidates (cdr candidates))
679 (when (memq candidate faces)
680 (setq face candidate)))
681 face))
682
683(defun erc-track-modified-channels ()
684 "Hook function for `erc-insert-post-hook' to check if the current
685buffer should be added to the modeline as a hidden, modified
686channel. Assumes it will only be called when current-buffer
687is in `erc-mode'."
688 (let ((this-channel (or (erc-default-target)
689 (buffer-name (current-buffer)))))
690 (if (and (not (erc-buffer-visible (current-buffer)))
691 (not (member this-channel erc-track-exclude))
692 (not (and erc-track-exclude-server-buffer
693 (string= this-channel
694 (buffer-name (erc-server-buffer)))))
695 (not (erc-message-type-member
696 (or (erc-find-parsed-property)
697 (point-min))
698 erc-track-exclude-types)))
699 ;; If the active buffer is not visible (not shown in a
700 ;; window), and not to be excluded, determine the kinds of
701 ;; faces used in the current message, and unless the user
702 ;; wants to ignore changes in certain channels where there
703 ;; are no faces corresponding to `erc-track-faces-priority-list',
704 ;; and the faces in the current message are found in said
705 ;; priority list, add the buffer to the erc-modified-channels-alist,
706 ;; if it is not already there. If the buffer is already on the list
707 ;; (in the car), change its face attribute (in the cddr) if
708 ;; necessary. See `erc-modified-channels-alist' for the
709 ;; exact data structure used.
710 (let ((faces (erc-faces-in (buffer-string))))
711 (unless (and
712 (or (eq erc-track-priority-faces-only 'all)
713 (member this-channel erc-track-priority-faces-only))
714 (not (catch 'found
715 (dolist (f faces)
716 (when (member f erc-track-faces-priority-list)
717 (throw 'found t))))))
718 (if (not (assq (current-buffer) erc-modified-channels-alist))
719 ;; Add buffer, faces and counts
720 (setq erc-modified-channels-alist
721 (cons (cons (current-buffer)
722 (cons 1 (erc-track-find-face faces)))
723 erc-modified-channels-alist))
724 ;; Else modify the face for the buffer, if necessary.
725 (when faces
726 (let* ((cell (assq (current-buffer)
727 erc-modified-channels-alist))
728 (old-face (cddr cell))
729 (new-face (erc-track-find-face
730 (if old-face
731 (cons old-face faces)
732 faces))))
733 (setcdr cell (cons (1+ (cadr cell)) new-face)))))
734 ;; And display it
735 (erc-modified-channels-display)))
736 ;; Else if the active buffer is the current buffer, remove it
737 ;; from our list.
738 (when (or (erc-buffer-visible (current-buffer))
739 (and this-channel
740 (assq (current-buffer) erc-modified-channels-alist)
741 (member this-channel erc-track-exclude)))
742 ;; Remove it from mode-line if buffer is visible or
743 ;; channel was added to erc-track-exclude recently.
744 (erc-modified-channels-remove-buffer (current-buffer))
745 (erc-modified-channels-display)))))
746
747(defun erc-faces-in (str)
748 "Return a list of all faces used in STR."
749 (let ((i 0)
750 (m (length str))
751 (faces (erc-list (get-text-property 0 'face str))))
752 (while (and (setq i (next-single-property-change i 'face str m))
753 (not (= i m)))
754 (dolist (face (erc-list (get-text-property i 'face str)))
755 (add-to-list 'faces face)))
756 faces))
757
758(erc-assert
759 (let ((str "is bold"))
760 (put-text-property 3 (length str)
761 'face '(bold erc-current-nick-face)
762 str)
763 (erc-faces-in str)))
764
765(defun erc-find-parsed-property ()
766 "Find the next occurrence of the `erc-parsed' text property."
767 (text-property-not-all (point-min) (point-max) 'erc-parsed nil))
768
769;;; Buffer switching
770
771(defvar erc-track-last-non-erc-buffer nil
772 "Stores the name of the last buffer you were in before activating
773`erc-track-switch-buffers'")
774
775(defun erc-track-sort-by-activest ()
776 "Sort erc-modified-channels-alist by activity.
777That means the number of unseen messages in a channel."
778 (setq erc-modified-channels-alist
779 (sort erc-modified-channels-alist
780 (lambda (a b) (> (nth 1 a) (nth 1 b))))))
781
782(defun erc-track-get-active-buffer (arg)
783 "Return the buffer name of ARG in `erc-modified-channels-alist'.
784Negative arguments index in the opposite direction. This direction is
785relative to `erc-track-switch-direction'"
786 (let ((dir erc-track-switch-direction)
787 offset)
788 (when (< arg 0)
789 (setq dir (case dir
790 (oldest 'newest)
791 (newest 'oldest)
792 (mostactive 'leastactive)
793 (leastactive 'mostactive)))
794 (setq arg (- arg)))
795 (setq offset (case dir
796 ((oldest leastactive)
797 (- (length erc-modified-channels-alist) arg))
798 (t (1- arg))))
799 ;; normalise out of range user input
800 (cond ((>= offset (length erc-modified-channels-alist))
801 (setq offset (1- (length erc-modified-channels-alist))))
802 ((< offset 0)
803 (setq offset 0)))
804 (car (nth offset erc-modified-channels-alist))))
805
806(defun erc-track-switch-buffer (arg)
807 "Switch to the next active ERC buffer, or if there are no active buffers,
808switch back to the last non-ERC buffer visited. Next is defined by
809`erc-track-switch-direction', a negative argument will reverse this."
810 (interactive "p")
811 (when erc-track-mode
812 (cond (erc-modified-channels-alist
813 ;; if we're not in erc-mode, set this buffer to return to
814 (unless (eq major-mode 'erc-mode)
815 (setq erc-track-last-non-erc-buffer (current-buffer)))
816 ;; and jump to the next active channel
817 (switch-to-buffer (erc-track-get-active-buffer arg)))
818 ;; if no active channels, switch back to what we were doing before
819 ((and erc-track-last-non-erc-buffer
820 erc-track-switch-from-erc
821 (buffer-live-p erc-track-last-non-erc-buffer))
822 (switch-to-buffer erc-track-last-non-erc-buffer)))))
823
824;; These bindings are global, because they pop us from any other
825;; buffer to an active ERC buffer!
826
827(global-set-key (kbd "C-c C-@") 'erc-track-switch-buffer)
828(global-set-key (kbd "C-c C-SPC") 'erc-track-switch-buffer)
829
830(provide 'erc-track)
831
832;;; erc-track.el ends here
833;;
834;; Local Variables:
835;; indent-tabs-mode: t
836;; tab-width: 8
837;; End:
838
839;; arch-tag: 11b439f5-e5d7-4c6c-bb3f-eda98f9b0ac1
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
new file mode 100644
index 00000000000..49cd20d759c
--- /dev/null
+++ b/lisp/erc/erc-truncate.el
@@ -0,0 +1,121 @@
1;;; erc-truncate.el --- Functions for truncating ERC buffers
2
3;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Andreas Fuchs <asf@void.at>
6;; Keywords: IRC, chat, client, Internet, logging
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This implements buffer truncation (and optional log file writing
28;; support for the Emacs IRC client. Use `erc-truncate-mode' to switch
29;; on. Use `erc-enable-logging' to enable logging of the stuff which
30;; is getting truncated.
31
32;;; Code:
33
34(require 'erc)
35
36(defgroup erc-truncate nil
37 "Truncate buffers when they reach a certain size"
38 :group 'erc)
39
40(defcustom erc-max-buffer-size 30000
41 "*Maximum size in chars of each ERC buffer.
42Used only when auto-truncation is enabled.
43\(see `erc-truncate-buffer' and `erc-insert-post-hook')."
44 :group 'erc-truncate
45 :type 'integer)
46
47;;;###autoload (autoload 'erc-truncate-mode "erc-truncate" nil t)
48(define-erc-module truncate nil
49 "Truncate a query buffer if it gets too large.
50This prevents the query buffer from getting too large, which can
51bring any grown emacs to its knees after a few days worth of
52tracking heavy-traffic channels."
53 ;;enable
54 ((add-hook 'erc-insert-post-hook 'erc-truncate-buffer))
55 ;; disable
56 ((remove-hook 'erc-insert-post-hook 'erc-truncate-buffer)))
57
58;;;###autoload
59(defun erc-truncate-buffer-to-size (size &optional buffer)
60 "Truncates the buffer to the size SIZE.
61If BUFFER is not provided, the current buffer is assumed. The deleted
62region is logged if `erc-logging-enabled' returns non-nil."
63 ;; If buffer is non-nil, but get-buffer does not return anything,
64 ;; then this is a bug. If buffer is a buffer name, get the buffer
65 ;; object. If buffer is nil, use the current buffer.
66 (if (not buffer)
67 (setq buffer (current-buffer))
68 (unless (get-buffer buffer)
69 (error "erc-truncate-buffer-to-size: %S is not a buffer" buffer)))
70 (when (> (buffer-size buffer) (+ size 512))
71 (save-excursion
72 (set-buffer buffer)
73 ;; Note that when erc-insert-post-hook runs, the buffer is
74 ;; narrowed to the new message. So do this delicate widening.
75 ;; I am not sure, I think this was not recommended behaviour in
76 ;; Emacs 20.
77 (save-restriction
78 (widen)
79 (let ((end (- erc-insert-marker size)))
80 ;; truncate at line boundaries
81 (goto-char end)
82 (beginning-of-line)
83 (setq end (point))
84 ;; try to save the current buffer using
85 ;; `erc-save-buffer-in-logs'. We use this, in case the
86 ;; user has both `erc-save-buffer-in-logs' and
87 ;; `erc-truncate-buffer' in `erc-insert-post-hook'. If
88 ;; this is the case, only the non-saved part of the current
89 ;; buffer should be saved. Rather than appending the
90 ;; deleted part of the buffer to the log file.
91 ;;
92 ;; Alternatively this could be made conditional on:
93 ;; (not (memq 'erc-save-buffer-in-logs
94 ;; erc-insert-post-hook))
95 ;; Comments?
96 (when (and (boundp 'erc-enable-logging)
97 erc-enable-logging
98 (erc-logging-enabled buffer))
99 (erc-save-buffer-in-logs))
100 ;; disable undoing for the truncating
101 (buffer-disable-undo)
102 (let ((inhibit-read-only t))
103 (delete-region (point-min) end)))
104 (buffer-enable-undo)))))
105
106;;;###autoload
107(defun erc-truncate-buffer ()
108 "Truncates the current buffer to `erc-max-buffer-size'.
109Meant to be used in hooks, like `erc-insert-post-hook'."
110 (interactive)
111 (erc-truncate-buffer-to-size erc-max-buffer-size))
112
113(provide 'erc-truncate)
114;;; erc-truncate.el ends here
115;;
116;; Local Variables:
117;; indent-tabs-mode: t
118;; tab-width: 8
119;; End:
120
121;; arch-tag: 22a2ea78-871f-4870-8f1e-efe534170311
diff --git a/lisp/erc/erc-viper.el b/lisp/erc/erc-viper.el
new file mode 100644
index 00000000000..0d6ff04ff92
--- /dev/null
+++ b/lisp/erc/erc-viper.el
@@ -0,0 +1,74 @@
1;;; erc-viper.el --- Viper compatibility hacks for ERC
2
3;; Copyright (C) 2005 Free Software Foundation, Inc.
4
5;; Author: Edward O'Connor <ted@oconnor.cx>
6;; Keywords: emulation
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; Viper is a VI emulation mode for Emacs. ERC and Viper don't quite get
28;; along by default; the code in this file fixes that. A simple
29;; (require 'erc-viper)
30;; in your ~/.ercrc.el should be all it takes for you to use ERC and
31;; Viper together happily.
32
33;;; Code:
34
35(require 'viper)
36
37;; We need this for `erc-mode-hook' and `erc-buffer-list'. Perhaps it
38;; would be better to use an `eval-after-load', so that there could be
39;; some autodetection / loading of this file from within erc.el?
40(require 'erc)
41
42;; Fix RET in ERC buffers, by telling Viper to pass RET through to the
43;; normal keymap.
44
45(add-to-list 'viper-major-mode-modifier-list
46 '(erc-mode insert-state viper-comint-mode-modifier-map))
47(add-to-list 'viper-major-mode-modifier-list
48 '(erc-mode vi-state viper-comint-mode-modifier-map))
49
50(viper-apply-major-mode-modifiers)
51
52;; Ensure that ERC buffers come up in insert state.
53(add-to-list 'viper-insert-state-mode-list 'erc-mode)
54
55;; Fix various local variables in Viper.
56(add-hook 'erc-mode-hook 'viper-comint-mode-hook)
57
58;; Fix ERC buffers that already exist (buffers in which `erc-mode-hook'
59;; has already been run).
60(mapc (lambda (buf)
61 (with-current-buffer buf
62 (viper-comint-mode-hook)
63 ;; If there *is* a final newline in this buffer, delete it, as
64 ;; it interferes with ERC /-commands.
65 (let ((last (1- (point-max))))
66 (when (eq (char-after last) ?\n)
67 (goto-char last)
68 (delete-char 1)))))
69 (erc-buffer-list))
70
71(provide 'erc-viper)
72
73;; arch-tag: 659fa645-e9ad-428c-ad53-8304d9f900f6
74;;; erc-viper.el ends here
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
new file mode 100644
index 00000000000..7c8ee6fff62
--- /dev/null
+++ b/lisp/erc/erc-xdcc.el
@@ -0,0 +1,130 @@
1;;; erc-xdcc.el --- XDCC file-server support for ERC
2
3;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4
5;; Author: Mario Lang <mlang@delysid.org>
6;; Keywords: comm, processes
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This file provides a very simple XDCC file server for the Emacs IRC Client.
28
29;;; Code:
30
31(require 'erc-dcc)
32
33(defcustom erc-xdcc-files nil
34 "*List of files to offer via XDCC.
35Your friends should issue \"/ctcp yournick XDCC list\" to see this."
36 :group 'erc-dcc
37 :type '(repeat file))
38
39(defcustom erc-xdcc-verbose-flag t
40 "*Report XDCC CTCP requests in the server buffer."
41 :group 'erc-dcc
42 :type 'boolean)
43
44(defcustom erc-xdcc-handler-alist
45 '(("help" . erc-xdcc-help)
46 ("list" . erc-xdcc-list)
47 ("send" . erc-xdcc-send))
48 "*Sub-command handler alist for XDCC CTCP queries."
49 :group 'erc-dcc
50 :type '(alist :key-type (string :tag "Sub-command") :value-type function))
51
52(defcustom erc-xdcc-help-text
53 '(("Hey " nick ", wondering how this works? Pretty easy.")
54 ("Available commands: XDCC ["
55 (mapconcat 'car erc-xdcc-handler-alist "|") "]")
56 ("Type \"/ctcp " (erc-current-nick)
57 " XDCC list\" to see the list of offered files, then type \"/ctcp "
58 (erc-current-nick) " XDCC send #\" to get a particular file number."))
59 "*Help text sent in response to XDCC help command.
60A list of messages, each consisting of strings and expressions, expressions
61being evaluated and should return stings."
62 :group 'erc-dcc
63 :type '(repeat (repeat :tag "Message" (choice string sexp))))
64
65;;;###autoload
66(defun erc-xdcc-add-file (file)
67 "Add a file to `erc-xdcc-files'."
68 (interactive "fFilename to add to XDCC: ")
69 (if (file-exists-p file)
70 (add-to-list 'erc-xdcc-files file)))
71
72(defun erc-xdcc-reply (proc nick msg)
73 (process-send-string proc
74 (format "PRIVMSG %s :%s\n" nick msg)))
75
76;; CTCP query handlers
77
78(defvar erc-ctcp-query-XDCC-hook '(erc-xdcc)
79 "Hook called whenever a CTCP XDCC message is received.")
80
81(defun erc-xdcc (proc nick login host to query)
82 "Handle incoming CTCP XDCC queries."
83 (when erc-xdcc-verbose-flag
84 (erc-display-message nil 'notice proc
85 (format "XDCC %s (%s@%s) sends %S" nick login host query)))
86 (let* ((args (cdr (delete "" (split-string query " "))))
87 (handler (cdr (assoc (downcase (car args)) erc-xdcc-handler-alist))))
88 (if (and handler (functionp handler))
89 (funcall handler proc nick login host (cdr args))
90 (erc-xdcc-reply
91 proc nick
92 (format "Unknown XDCC sub-command, try \"/ctcp %s XDCC help\""
93 (erc-current-nick))))))
94
95(defun erc-xdcc-help (proc nick login host args)
96 "Send basic help information to NICK."
97 (mapc
98 (lambda (msg)
99 (erc-xdcc-reply proc nick
100 (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt))) msg "")))
101 erc-xdcc-help-text))
102
103(defun erc-xdcc-list (proc nick login host args)
104 "Show the contents of `erc-xdcc-files' via privmsg to NICK."
105 (if (null erc-xdcc-files)
106 (erc-xdcc-reply proc nick "No files offered, sorry")
107 (erc-xdcc-reply proc nick "Num Filename")
108 (erc-xdcc-reply proc nick "--- -------------")
109 (let ((n 0))
110 (dolist (file erc-xdcc-files)
111 (erc-xdcc-reply proc nick
112 (format "%02d. %s"
113 (setq n (1+ n))
114 (erc-dcc-file-to-name file)))))))
115
116(defun erc-xdcc-send (proc nick login host args)
117 "Send a file to NICK."
118 (let ((n (string-to-number (car args)))
119 (len (length erc-xdcc-files)))
120 (cond
121 ((= len 0)
122 (erc-xdcc-reply proc nick "No files offered, sorry"))
123 ((or (< n 1) (> n len))
124 (erc-xdcc-reply proc nick (format "%d out of range" n)))
125 (t (erc-dcc-send-file nick (nth (1- n) erc-xdcc-files) proc)))))
126
127(provide 'erc-xdcc)
128
129;; arch-tag: a13b62fe-2399-4562-af4e-f18a8dd4b9c8
130;;; erc-xdcc.el ends here
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
new file mode 100644
index 00000000000..9ff3ff51dc5
--- /dev/null
+++ b/lisp/erc/erc.el
@@ -0,0 +1,6144 @@
1;; erc.el --- An Emacs Internet Relay Chat client
2
3;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4;; 2006 Free Software Foundation, Inc.
5;; Copyright (C) 2004 Brian Palmer
6
7;; Author: Alexander L. Belikoff (alexander@belikoff.net)
8;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu),
9;; Mario Lang (mlang@delysid.org),
10;; Alex Schroeder (alex@gnu.org)
11;; Andreas Fuchs (afs@void.at)
12;; Gergely Nagy (algernon@midgard.debian.net)
13;; David Edmondson (dme@dme.org)
14;; Maintainer: Mario Lang (mlang@delysid.org)
15;; Keywords: IRC, chat, client, Internet
16
17;; This file is part of GNU Emacs.
18
19;; GNU Emacs is free software; you can redistribute it and/or modify
20;; it under the terms of the GNU General Public License as published by
21;; the Free Software Foundation; either version 2, or (at your option)
22;; any later version.
23
24;; GNU Emacs is distributed in the hope that it will be useful,
25;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;; GNU General Public License for more details.
28
29;; You should have received a copy of the GNU General Public License
30;; along with GNU Emacs; see the file COPYING. If not, write to the
31;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32;; Boston, MA 02110-1301, USA.
33
34;;; Commentary:
35
36;; ERC is an IRC client for Emacs.
37
38;; For more information, see the following URLs:
39;; * http://sf.net/projects/erc/
40;; * http://www.emacswiki.org/cgi-bin/wiki.pl?EmacsIRCClient
41
42;; Jul-26-2001. erc.el is now in CVS on SourceForge. I invite everyone
43;; who wants to hack it to contact me <mlang@delysid.org> in order to
44;; get write access on the CVS.
45
46;; Installation:
47
48;; Put erc.el in your load-path, and put (require 'erc) in your .emacs.
49
50;; Configuration:
51
52;; Use M-x customize-group RET erc RET to get an overview
53;; of all the variables you can tweak.
54
55;; Usage:
56
57;; To connect to an IRC server, do
58;;
59;; M-x erc-select RET
60;;
61;; After you are connected to a server, you can use C-h m or have a look at
62;; the IRC menu.
63
64;;; History:
65;;
66
67;;; Code:
68
69(defconst erc-version-string "Version 5.1 (Emacs 22)"
70 "ERC version. This is used by function `erc-version'.")
71
72(eval-when-compile (require 'cl))
73(require 'font-lock)
74(require 'pp)
75(require 'thingatpt)
76(require 'erc-compat)
77(require 'erc-menu)
78
79(defvar erc-official-location
80 "http://erc.sf.net (comments mailto://mlang@delysid.org)"
81 "Location of the ERC client on the Internet.")
82
83(defgroup erc nil
84 "Emacs Internet Relay Chat client."
85 :link '(url-link "http://www.emacswiki.org/cgi-bin/wiki.pl?EmacsIRCClient")
86 :prefix "erc-"
87 :group 'applications)
88
89(defgroup erc-buffers nil
90 "Creating new ERC buffers"
91 :group 'erc)
92
93(defgroup erc-display nil
94 "Settings for how various things are displayed"
95 :group 'erc)
96
97(defgroup erc-mode-line-and-header nil
98 "Displaying information in the mode-line and header"
99 :group 'erc-display)
100
101(defgroup erc-ignore nil
102 "Ignoring certain messages"
103 :group 'erc)
104
105(defgroup erc-query nil
106 "Using separate buffers for private discussions"
107 :group 'erc)
108
109(defgroup erc-quit-and-part nil
110 "Quitting and parting channels"
111 :group 'erc)
112
113(defgroup erc-paranoia nil
114 "Know what is sent and received; control the display of sensitive data."
115 :group 'erc)
116
117(defgroup erc-scripts nil
118 "Running scripts at startup and with /LOAD"
119 :group 'erc)
120
121(require 'erc-backend)
122
123;; compatibility with older ERC releases
124
125(if (fboundp 'defvaralias)
126 (progn
127 (defvaralias 'erc-announced-server-name 'erc-server-announced-name)
128 (erc-make-obsolete-variable 'erc-announced-server-name
129 'erc-server-announced-name
130 "ERC 5.1")
131 (defvaralias 'erc-process 'erc-server-process)
132 (erc-make-obsolete-variable 'erc-process 'erc-server-process "ERC 5.1")
133 (defvaralias 'erc-default-coding-system 'erc-server-coding-system)
134 (erc-make-obsolete-variable 'erc-default-coding-system
135 'erc-server-coding-system
136 "ERC 5.1"))
137 (message (concat "ERC: The function `defvaralias' is not bound. See the "
138 "NEWS file for variable name changes since ERC 5.0.4.")))
139
140(defalias 'erc-send-command 'erc-server-send)
141(erc-make-obsolete 'erc-send-command 'erc-server-send "ERC 5.1")
142
143;; tunable connection and authentication parameters
144
145(defcustom erc-server nil
146 "IRC server to use.
147See function `erc-compute-server' for more details on connection
148parameters and authentication."
149 :group 'erc
150 :type '(choice (const nil) string))
151
152(defcustom erc-port nil
153 "IRC port to use."
154 :group 'erc
155 :type '(choice (const nil) number string))
156
157(defcustom erc-nick nil
158 "Nickname to use.
159
160Can be either a string, or a list of strings.
161In the latter case, if the first nick in the list is already in use,
162other nicks are tried in the list order.
163
164See function `erc-compute-nick' for more details on connection
165parameters and authentication."
166 :group 'erc
167 :type '(choice (const nil)
168 (string :tag "Nickname")
169 (repeat string)))
170
171(defcustom erc-nick-uniquifier "`"
172 "The character to append to the nick if it is already in use."
173 :group 'erc
174 :type 'string)
175
176(defcustom erc-manual-set-nick-on-bad-nick-p nil
177 "If the nickname you chose isn't available, ERC should not automatically
178attempt to set another nickname. You can manually set another nickname with
179the /NICK command."
180 :group 'erc
181 :type 'boolean)
182
183(defcustom erc-user-full-name nil
184 "User full name.
185
186See function `erc-compute-full-name' for more details on connection
187parameters and authentication."
188 :group 'erc
189 :type '(choice (const nil) string function)
190 :set (lambda (sym val)
191 (if (functionp val)
192 (set sym (funcall val))
193 (set sym val))))
194
195(defvar erc-password nil
196 "ERC password to use in authentication (not necessary).")
197
198(defcustom erc-user-mode nil
199 "Initial user modes to be set after a connection is established."
200 :group 'erc
201 :type '(choice (const nil) string function))
202
203
204(defcustom erc-prompt-for-password t
205 "Asks before using the default password, or whether to enter a new one."
206 :group 'erc
207 :type 'boolean)
208
209(defcustom erc-warn-about-blank-lines t
210 "Warn the user if they attempt to send a blank line."
211 :group 'erc
212 :type 'boolean)
213
214(defcustom erc-send-whitespace-lines nil
215 "If set to non-nil, send lines consisting of only whitespace."
216 :group 'erc
217 :type 'boolean)
218
219(defcustom erc-hide-prompt nil
220 "If non-nil, do not display the prompt for commands.
221
222\(A command is any input starting with a '/').
223
224See also the variables `erc-prompt' and `erc-command-indicator'."
225 :group 'erc-display
226 :type 'boolean)
227
228;; tunable GUI stuff
229
230(defcustom erc-show-my-nick t
231 "If non-nil, display one's own nickname when sending a message.
232
233If non-nil, \"<nickname>\" will be shown.
234If nil, only \"> \" will be shown."
235 :group 'erc-display
236 :type 'boolean)
237
238(define-widget 'erc-message-type 'set
239 "A set of standard IRC Message types."
240 :args '((const "JOIN")
241 (const "KICK")
242 (const "NICK")
243 (const "PART")
244 (const "QUIT")
245 (const "MODE")
246 (repeat :inline t :tag "Others" (string :tag "IRC Message Type"))))
247
248(defcustom erc-hide-list nil
249 "*List of IRC type messages to hide.
250A typical value would be '(\"JOIN\" \"PART\" \"QUIT\")."
251 :group 'erc-ignore
252 :type 'erc-message-type)
253
254(defvar erc-session-password nil
255 "The password used for the current session.")
256(make-variable-buffer-local 'erc-session-password)
257
258(defcustom erc-disconnected-hook nil
259 "Run this hook with arguments (NICK IP REASON) when disconnected.
260This happens before automatic reconnection. Note, that
261`erc-server-QUIT-functions' might not be run when we disconnect,
262simply because we do not necessarily receive the QUIT event."
263 :group 'erc-hooks
264 :type 'hook)
265
266(defcustom erc-complete-functions nil
267 "These functions get called when the user hits TAB in ERC.
268Each function in turn is called until one returns non-nil to
269indicate it has handled the input."
270 :group 'erc-hooks
271 :type 'hook)
272
273(defcustom erc-join-hook nil
274 "Hook run when we join a channel. Hook functions are called
275without arguments, with the current buffer set to the buffer of
276the new channel.
277
278See also `erc-server-JOIN-functions', `erc-part-hook'."
279 :group 'erc-hooks
280 :type 'hook)
281
282(defcustom erc-quit-hook nil
283 "Hook run when processing a quit command directed at our nick.
284
285The hook receives one argument, the current PROCESS.
286See also `erc-server-QUIT-functions' and `erc-disconnected-hook'."
287 :group 'erc-hooks
288 :type 'hook)
289
290(defcustom erc-part-hook nil
291 "Hook run when processing a PART message directed at our nick.
292
293The hook receives one argument, the current BUFFER.
294See also `erc-server-QUIT-functions', `erc-quit-hook' and
295`erc-disconnected-hook'."
296 :group 'erc-hooks
297 :type 'hook)
298
299(defcustom erc-kick-hook nil
300 "Hook run when processing a KICK message directed at our nick.
301
302The hook receives one argument, the current BUFFER.
303See also `erc-server-PART-functions' and `erc-part-hook'."
304 :group 'erc-hooks
305 :type 'hook)
306
307(defcustom erc-nick-changed-functions nil
308 "List of functions run when your nick was successfully changed.
309
310Each function should accept two arguments, NEW-NICK and OLD-NICK."
311 :group 'erc-hooks
312 :type 'hook)
313
314(defcustom erc-connect-pre-hook '(erc-initialize-log-marker)
315 "Hook called just before `erc' calls `erc-connect'.
316Functions are run in the buffer-to-be."
317 :group 'erc-hooks
318 :type 'hook)
319
320
321(defvar erc-channel-users nil
322 "A hash table of members in the current channel, which
323associates nicknames with cons cells of the form:
324\(USER . MEMBER-DATA) where USER is a pointer to an
325erc-server-user struct, and MEMBER-DATA is a pointer to an
326erc-channel-user struct.")
327(make-variable-buffer-local 'erc-channel-users)
328
329(defvar erc-server-users nil
330 "A hash table of users on the current server, which associates
331nicknames with erc-server-user struct instances.")
332(make-variable-buffer-local 'erc-server-users)
333
334(defun erc-downcase (string)
335 "Convert STRING to IRC standard conforming downcase."
336 (let ((s (downcase string))
337 (c '((?\[ . ?\{)
338 (?\] . ?\})
339 (?\\ . ?\|)
340 (?~ . ?^))))
341 (save-match-data
342 (while (string-match "[]\\[~]" s)
343 (aset s (match-beginning 0)
344 (cdr (assq (aref s (match-beginning 0)) c)))))
345 s))
346
347(defstruct (erc-server-user (:type vector) :named)
348 ;; User data
349 nickname host login full-name info
350 ;; Buffers
351 ;;
352 ;; This is an alist of the form (BUFFER . CHANNEL-DATA), where
353 ;; CHANNEL-DATA is either nil or an erc-channel-user struct.
354 (buffers nil)
355 )
356
357(defstruct (erc-channel-user (:type vector) :named)
358 op voice
359 ;; Last message time (in the form of the return value of
360 ;; (current-time)
361 ;;
362 ;; This is useful for ordered name completion.
363 (last-message-time nil))
364
365(defsubst erc-get-channel-user (nick)
366 "Finds the (USER . CHANNEL-DATA) element corresponding to NICK
367in the current buffer's `erc-channel-users' hash table."
368 (gethash (erc-downcase nick) erc-channel-users))
369
370(defsubst erc-get-server-user (nick)
371 "Finds the USER corresponding to NICK in the current server's
372`erc-server-users' hash table."
373 (with-current-buffer (process-buffer erc-server-process)
374 (gethash (erc-downcase nick) erc-server-users)))
375
376(defsubst erc-add-server-user (nick user)
377 "This function is for internal use only.
378
379Adds USER with nickname NICK to the `erc-server-users' hash table."
380 (with-current-buffer (process-buffer erc-server-process)
381 (puthash (erc-downcase nick) user erc-server-users)))
382
383(defsubst erc-remove-server-user (nick)
384 "This function is for internal use only.
385
386Removes the user with nickname NICK from the `erc-server-users'
387hash table. This user is not removed from the
388`erc-channel-users' lists of other buffers.
389
390See also: `erc-remove-user'."
391 (with-current-buffer (process-buffer erc-server-process)
392 (remhash (erc-downcase nick) erc-server-users)))
393
394(defun erc-change-user-nickname (user new-nick)
395 "This function is for internal use only.
396
397Changes the nickname of USER to NEW-NICK in the
398`erc-server-users' hash table. The `erc-channel-users' lists of
399other buffers are also changed."
400 (let ((nick (erc-server-user-nickname user)))
401 (setf (erc-server-user-nickname user) new-nick)
402 (with-current-buffer (process-buffer erc-server-process)
403 (remhash (erc-downcase nick) erc-server-users)
404 (puthash (erc-downcase new-nick) user erc-server-users))
405 (dolist (buf (erc-server-user-buffers user))
406 (if (buffer-live-p buf)
407 (with-current-buffer buf
408 (let ((cdata (erc-get-channel-user nick)))
409 (remhash (erc-downcase nick) erc-channel-users)
410 (puthash (erc-downcase new-nick) cdata
411 erc-channel-users)))))))
412
413(defun erc-remove-channel-user (nick)
414 "This function is for internal use only.
415
416Removes the user with nickname NICK from the `erc-channel-users'
417list for this channel. If this user is not in the
418`erc-channel-users' list of any other buffers, the user is also
419removed from the server's `erc-server-users' list.
420
421See also: `erc-remove-server-user' and `erc-remove-user'."
422 (let ((channel-data (erc-get-channel-user nick)))
423 (when channel-data
424 (let ((user (car channel-data)))
425 (setf (erc-server-user-buffers user)
426 (delq (current-buffer)
427 (erc-server-user-buffers user)))
428 (remhash (erc-downcase nick) erc-channel-users)
429 (if (null (erc-server-user-buffers user))
430 (erc-remove-server-user nick))))))
431
432(defun erc-remove-user (nick)
433 "This function is for internal use only.
434
435Removes the user with nickname NICK from the `erc-server-users'
436list as well as from all `erc-channel-users' lists.
437
438See also: `erc-remove-server-user' and
439`erc-remove-channel-user'."
440 (let ((user (erc-get-server-user nick)))
441 (when user
442 (let ((buffers (erc-server-user-buffers user)))
443 (dolist (buf buffers)
444 (if (buffer-live-p buf)
445 (with-current-buffer buf
446 (remhash (erc-downcase nick) erc-channel-users)
447 (run-hooks 'erc-channel-members-changed-hook)))))
448 (erc-remove-server-user nick))))
449
450(defun erc-remove-channel-users ()
451 "This function is for internal use only.
452
453Removes all users in the current channel. This is called by
454`erc-server-PART' and `erc-server-QUIT'."
455 (when (and erc-server-connected
456 (erc-server-process-alive)
457 (hash-table-p erc-channel-users))
458 (maphash (lambda (nick cdata)
459 (erc-remove-channel-user nick))
460 erc-channel-users)
461 (clrhash erc-channel-users)))
462
463(defsubst erc-channel-user-op-p (nick)
464 "Return `t' if NICK is an operator in the current channel."
465 (and nick
466 (hash-table-p erc-channel-users)
467 (let ((cdata (erc-get-channel-user nick)))
468 (and cdata (cdr cdata)
469 (erc-channel-user-op (cdr cdata))))))
470
471(defsubst erc-channel-user-voice-p (nick)
472 "Return `t' if NICK has voice in the current channel."
473 (and nick
474 (hash-table-p erc-channel-users)
475 (let ((cdata (erc-get-channel-user nick)))
476 (and cdata (cdr cdata)
477 (erc-channel-user-voice (cdr cdata))))))
478
479(defun erc-get-channel-user-list ()
480 "Returns a list of users in the current channel. Each element
481of the list is of the form (USER . CHANNEL-DATA), where USER is
482an erc-server-user struct, and CHANNEL-DATA is either `nil' or an
483erc-channel-user struct.
484
485See also: `erc-sort-channel-users-by-activity'"
486 (let (users)
487 (if (hash-table-p erc-channel-users)
488 (maphash (lambda (nick cdata)
489 (setq users (cons cdata users)))
490 erc-channel-users))
491 users))
492
493(defun erc-get-server-nickname-list ()
494 "Returns a list of known nicknames on the current server."
495 (if (erc-server-process-alive)
496 (with-current-buffer (erc-server-buffer)
497 (let (nicks)
498 (when (hash-table-p erc-server-users)
499 (maphash (lambda (n user)
500 (setq nicks
501 (cons (erc-server-user-nickname user)
502 nicks)))
503 erc-server-users)
504 nicks)))))
505
506(defun erc-get-channel-nickname-list ()
507 "Returns a list of known nicknames on the current channel."
508 (let (nicks)
509 (when (hash-table-p erc-channel-users)
510 (maphash (lambda (n cdata)
511 (setq nicks
512 (cons (erc-server-user-nickname (car cdata))
513 nicks)))
514 erc-channel-users)
515 nicks)))
516
517(defun erc-get-server-nickname-alist ()
518 "Returns an alist of known nicknames on the current server."
519 (if (erc-server-process-alive)
520 (with-current-buffer (erc-server-buffer)
521 (let (nicks)
522 (when (hash-table-p erc-server-users)
523 (maphash (lambda (n user)
524 (setq nicks
525 (cons (cons (erc-server-user-nickname user) nil)
526 nicks)))
527 erc-server-users)
528 nicks)))))
529
530(defun erc-get-channel-nickname-alist ()
531 "Returns an alist of known nicknames on the current channel."
532 (let (nicks)
533 (when (hash-table-p erc-channel-users)
534 (maphash (lambda (n cdata)
535 (setq nicks
536 (cons (cons (erc-server-user-nickname (car cdata)) nil)
537 nicks)))
538 erc-channel-users)
539 nicks)))
540
541(defun erc-sort-channel-users-by-activity (list)
542 "Sorts LIST such that users which have spoken most recently are
543listed first. LIST must be of the form (USER . CHANNEL-DATA).
544
545See also: `erc-get-channel-user-list'."
546 (sort list
547 (lambda (x y)
548 (when (and
549 (cdr x) (cdr y))
550 (let ((tx (erc-channel-user-last-message-time (cdr x)))
551 (ty (erc-channel-user-last-message-time (cdr y))))
552 (if tx
553 (if ty
554 (time-less-p ty tx)
555 t)
556 nil))))))
557
558(defun erc-sort-channel-users-alphabetically (list)
559 "Sort LIST so that users' nicknames are in alphabetical order.
560LIST must be of the form (USER . CHANNEL-DATA).
561
562See also: `erc-get-channel-user-list'."
563 (sort list
564 (lambda (x y)
565 (when (and
566 (cdr x) (cdr y))
567 (let ((nickx (downcase (erc-server-user-nickname (car x))))
568 (nicky (downcase (erc-server-user-nickname (car y)))))
569 (if nickx
570 (if nicky
571 (string-lessp nickx nicky)
572 t)
573 nil))))))
574
575(defvar erc-channel-topic nil
576 "A topic string for the channel. Should only be used in channel-buffers.")
577(make-variable-buffer-local 'erc-channel-topic)
578
579(defvar erc-channel-modes nil
580 "List of strings representing channel modes.
581E.g. '(\"i\" \"m\" \"s\" \"b Quake!*@*\")
582\(not sure the ban list will be here, but why not)")
583(make-variable-buffer-local 'erc-channel-modes)
584
585(defvar erc-insert-marker nil
586 "The place where insertion of new text in erc buffers should happen.")
587(make-variable-buffer-local 'erc-insert-marker)
588
589(defvar erc-input-marker nil
590 "The marker where input should be inserted.")
591(make-variable-buffer-local 'erc-input-marker)
592
593(defun erc-string-no-properties (string)
594 "Return a copy of STRING will all text-properties removed."
595 (let ((newstring (copy-sequence string)))
596 (set-text-properties 0 (length newstring) nil newstring)
597 newstring))
598
599(defcustom erc-prompt "ERC>"
600 "Prompt used by ERC. Trailing whitespace is not required."
601 :group 'erc-display
602 :type '(choice string function))
603
604(defun erc-prompt ()
605 "Return the input prompt as a string.
606
607See also the variable `erc-prompt'."
608 (let ((prompt (if (functionp erc-prompt)
609 (funcall erc-prompt)
610 erc-prompt)))
611 (if (> (length prompt) 0)
612 (concat prompt " ")
613 prompt)))
614
615(defcustom erc-command-indicator nil
616 "Indicator used by ERC for showing commands.
617
618If non-nil, this will be used in the ERC buffer to indicate
619commands (i.e., input starting with a '/').
620
621If nil, the prompt will be constructed from the variable `erc-prompt'."
622 :group 'erc-display
623 :type '(choice (const nil) string function))
624
625(defun erc-command-indicator ()
626 "Return the command indicator prompt as a string.
627
628This only has any meaning if the variable `erc-command-indicator' is non-nil."
629 (and erc-command-indicator
630 (let ((prompt (if (functionp erc-command-indicator)
631 (funcall erc-command-indicator)
632 erc-command-indicator)))
633 (if (> (length prompt) 0)
634 (concat prompt " ")
635 prompt))))
636
637(defcustom erc-notice-prefix "*** "
638 "*Prefix for all notices."
639 :group 'erc-display
640 :type 'string)
641
642(defcustom erc-notice-highlight-type 'all
643 "*Determines how to highlight notices.
644See `erc-notice-prefix'.
645
646The following values are allowed:
647
648 'prefix - highlight notice prefix only
649 'all - highlight the entire notice
650
651Any other value disables notice's highlighting altogether."
652 :group 'erc-display
653 :type '(choice (const :tag "highlight notice prefix only" prefix)
654 (const :tag "highlight the entire notice" all)
655 (const :tag "don't highlight notices at all" nil)))
656
657(defcustom erc-echo-notice-hook nil
658 "*Specifies a list of functions to call to echo a private
659notice. Each function is called with four arguments, the string
660to display, the parsed server message, the target buffer (or
661nil), and the sender. The functions are called in order, until a
662function evaluates to non-nil. These hooks are called after
663those specified in `erc-echo-notice-always-hook'.
664
665See also: `erc-echo-notice-always-hook',
666`erc-echo-notice-in-default-buffer',
667`erc-echo-notice-in-target-buffer',
668`erc-echo-notice-in-minibuffer',
669`erc-echo-notice-in-server-buffer',
670`erc-echo-notice-in-active-non-server-buffer',
671`erc-echo-notice-in-active-buffer',
672`erc-echo-notice-in-user-buffers',
673`erc-echo-notice-in-user-and-target-buffers',
674`erc-echo-notice-in-first-user-buffer'"
675 :group 'erc-hooks
676 :type 'hook
677 :options '(erc-echo-notice-in-default-buffer
678 erc-echo-notice-in-target-buffer
679 erc-echo-notice-in-minibuffer
680 erc-echo-notice-in-server-buffer
681 erc-echo-notice-in-active-non-server-buffer
682 erc-echo-notice-in-active-buffer
683 erc-echo-notice-in-user-buffers
684 erc-echo-notice-in-user-and-target-buffers
685 erc-echo-notice-in-first-user-buffer))
686
687(defcustom erc-echo-notice-always-hook
688 '(erc-echo-notice-in-default-buffer)
689 "*Specifies a list of functions to call to echo a private
690notice. Each function is called with four arguments, the string
691to display, the parsed server message, the target buffer (or
692nil), and the sender. The functions are called in order, and all
693functions are called. These hooks are called before those
694specified in `erc-echo-notice-hook'.
695
696See also: `erc-echo-notice-hook',
697`erc-echo-notice-in-default-buffer',
698`erc-echo-notice-in-target-buffer',
699`erc-echo-notice-in-minibuffer',
700`erc-echo-notice-in-server-buffer',
701`erc-echo-notice-in-active-non-server-buffer',
702`erc-echo-notice-in-active-buffer',
703`erc-echo-notice-in-user-buffers',
704`erc-echo-notice-in-user-and-target-buffers',
705`erc-echo-notice-in-first-user-buffer'"
706 :group 'erc-hooks
707 :type 'hook
708 :options '(erc-echo-notice-in-default-buffer
709 erc-echo-notice-in-target-buffer
710 erc-echo-notice-in-minibuffer
711 erc-echo-notice-in-server-buffer
712 erc-echo-notice-in-active-non-server-buffer
713 erc-echo-notice-in-active-buffer
714 erc-echo-notice-in-user-buffers
715 erc-echo-notice-in-user-and-target-buffers
716 erc-echo-notice-in-first-user-buffer))
717
718;; other tunable parameters
719
720(defcustom erc-whowas-on-nosuchnick nil
721 "*If non-nil, do a whowas on a nick if no such nick."
722 :group 'erc
723 :type 'boolean)
724
725(defcustom erc-verbose-server-ping nil
726 "*If non-nil, show every time you get a PING or PONG from the server."
727 :group 'erc-paranoia
728 :type 'boolean)
729
730(defcustom erc-public-away-p nil
731 "*Let others know you are back when you are no longer marked away.
732This happens in this form:
733* <nick> is back (gone for <time>)
734
735Many consider it impolite to do so automatically."
736 :group 'erc
737 :type 'boolean)
738
739(defcustom erc-away-nickname nil
740 "*The nickname to take when you are marked as being away."
741 :group 'erc
742 :type '(choice (const nil)
743 string))
744
745(defcustom erc-paranoid nil
746 "If non-nil, then all incoming CTCP requests will be shown."
747 :group 'erc-paranoia
748 :type 'boolean)
749
750(defcustom erc-disable-ctcp-replies nil
751 "Disable replies to CTCP requests that require a reply.
752If non-nil, then all incoming CTCP requests that normally require
753an automatic reply (like VERSION or PING) will be ignored. Good to
754set if some hacker is trying to flood you away."
755 :group 'erc-paranoia
756 :type 'boolean)
757
758(defcustom erc-anonymous-login t
759 "Be paranoid, don't give away your machine name."
760 :group 'erc-paranoia
761 :type 'boolean)
762
763(defcustom erc-prompt-for-channel-key nil
764 "Prompt for channel key when using `erc-join-channel' interactively"
765 :group 'erc
766 :type 'boolean)
767
768(defcustom erc-email-userid "user"
769 "Use this as your email user ID."
770 :group 'erc
771 :type 'string)
772
773(defcustom erc-ignore-list nil
774 "*List of regexps matching user identifiers to ignore.
775
776A user identifier has the form \"nick!login@host\". If an
777identifier matches, the message from the person will not be
778processed."
779 :group 'erc-ignore
780 :type '(repeat regexp))
781(make-variable-buffer-local 'erc-ignore-list)
782
783(defcustom erc-ignore-reply-list nil
784 "*List of regexps matching user identifiers to ignore completely.
785
786This differs from `erc-ignore-list' in that it also ignores any
787messages directed at the user.
788
789A user identifier has the form \"nick!login@host\".
790
791If an identifier matches, or a message is addressed to a nick
792whose identifier matches, the message will not be processed.
793
794CAVEAT: ERC doesn't know about the user and host of anyone who
795was already in the channel when you joined, but never said
796anything, so it won't be able to match the user and host of those
797people. You can update the ERC internal info using /WHO *."
798 :group 'erc-ignore
799 :type '(repeat regexp))
800
801(defvar erc-flood-protect t
802 "*If non-nil, flood protection is enabled.
803Flooding is sending too much information to the server in too
804short of an interval, which may cause the server to terminate the
805connection.
806
807See `erc-server-flood-margin' for other flood-related parameters.")
808
809;; Script parameters
810
811(defcustom erc-startup-file-list
812 '("~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
813 "List of files to try for a startup script.
814The first existent and readable one will get executed.
815
816If the filename ends with `.el' it is presumed to be an emacs-lisp
817script and it gets (load)ed. Otherwise is is treated as a bunch of
818regular IRC commands"
819 :group 'erc-scripts
820 :type '(repeat file))
821
822(defcustom erc-script-path nil
823 "List of directories to look for a script in /load command.
824The script is first searched in the current directory, then in each
825directory in the list."
826 :group 'erc-scripts
827 :type '(repeat directory))
828
829(defcustom erc-script-echo t
830 "*If not-NIL, echo the IRC script commands locally."
831 :group 'erc-scripts
832 :type 'boolean)
833
834(defvar erc-last-saved-position nil
835 "A marker containing the position the current buffer was last saved at.")
836(make-variable-buffer-local 'erc-last-saved-position)
837
838(defcustom erc-kill-buffer-on-part nil
839 "Kill the channel buffer on PART.
840This variable should probably stay nil, as ERC can reuse buffers if
841you rejoin them later."
842 :group 'erc-quit-and-part
843 :type 'boolean)
844
845(defcustom erc-kill-queries-on-quit nil
846 "Kill all query (also channel) buffers of this server on QUIT.
847See the variable `erc-kill-buffer-on-part' for details."
848 :group 'erc-quit-and-part
849 :type 'boolean)
850
851(defcustom erc-kill-server-buffer-on-quit nil
852 "Kill the server buffer of the process on QUIT."
853 :group 'erc-quit-and-part
854 :type 'boolean)
855
856(defcustom erc-quit-reason-various-alist nil
857 "Alist of possible arguments to the /quit command.
858
859Each element has the form:
860 (REGEXP RESULT)
861
862If REGEXP matches the argument to /quit, then its relevant RESULT
863will be used. RESULT may be either a string, or a function. If
864a function, it should return the quit message as a string.
865
866If no elements match, then the empty string is used.
867
868As an example:
869 (setq erc-quit-reason-various-alist
870 '((\"zippy\" erc-quit-reason-zippy)
871 (\"xmms\" dme:now-playing)
872 (\"version\" erc-quit-reason-normal)
873 (\"home\" \"Gone home !\")
874 (\"\" \"Default Reason\")))
875If the user types \"/quit zippy\", then a Zippy the Pinhead quotation
876will be used as the quit message."
877 :group 'erc-quit-and-part
878 :type '(repeat (list regexp (choice (string) (function)))))
879
880(defcustom erc-part-reason-various-alist nil
881 "Alist of possible arguments to the /part command.
882
883Each element has the form:
884 (REGEXP RESULT)
885
886If REGEXP matches the argument to /part, then its relevant RESULT
887will be used. RESULT may be either a string, or a function. If
888a function, it should return the part message as a string.
889
890If no elements match, then the empty string is used.
891
892As an example:
893 (setq erc-part-reason-various-alist
894 '((\"zippy\" erc-part-reason-zippy)
895 (\"xmms\" dme:now-playing)
896 (\"version\" erc-part-reason-normal)
897 (\"home\" \"Gone home !\")
898 (\"\" \"Default Reason\")))
899If the user types \"/part zippy\", then a Zippy the Pinhead quotation
900will be used as the part message."
901 :group 'erc-quit-and-part
902 :type '(repeat (list regexp (choice (string) (function)))))
903
904(defcustom erc-quit-reason 'erc-quit-reason-normal
905 "*A function which returns the reason for quitting.
906
907The function is passed a single argument, the string typed by the
908user after \"/quit\"."
909 :group 'erc-quit-and-part
910 :type '(choice (const erc-quit-reason-normal)
911 (const erc-quit-reason-zippy)
912 (const erc-quit-reason-various)
913 (symbol)))
914
915(defcustom erc-part-reason 'erc-part-reason-normal
916 "A function which returns the reason for parting a channel.
917
918The function is passed a single argument, the string typed by the
919user after \"/PART\"."
920 :group 'erc-quit-and-part
921 :type '(choice (const erc-part-reason-normal)
922 (const erc-part-reason-zippy)
923 (const erc-part-reason-various)
924 (symbol)))
925
926(defvar erc-grab-buffer-name "*erc-grab*"
927 "The name of the buffer created by `erc-grab-region'.")
928
929;; variables available for IRC scripts
930
931(defvar erc-user-information "ERC User"
932 "USER_INFORMATION IRC variable.")
933
934;; Hooks
935
936(defgroup erc-hooks nil
937 "Hook variables for fancy customizations of ERC."
938 :group 'erc)
939
940(defcustom erc-mode-hook nil
941 "Hook run after `erc-mode' setup is finished."
942 :group 'erc-hooks
943 :type 'hook
944 :options '(erc-add-scroll-to-bottom))
945
946(defcustom erc-timer-hook nil
947 "Put functions which should get called more or less periodically here.
948The idea is that servers always play ping pong with the client, and so there
949is no need for any idle-timer games with Emacs."
950 :group 'erc-hooks
951 :type 'hook)
952
953(defcustom erc-insert-pre-hook nil
954 "Hook called first when some text is inserted through `erc-display-line'.
955It gets called with one argument, STRING.
956To be able to modify the inserted text, use `erc-insert-modify-hook' instead.
957Filtering functions can set `erc-insert-this' to nil to avoid
958display of that particular string at all."
959 :group 'erc-hooks
960 :type 'hook)
961
962(defcustom erc-send-pre-hook nil
963 "Hook called first when some text is sent through `erc-send-current-line'.
964It gets called with one argument, STRING.
965
966To change the text that will be sent, set the variable STR which is
967used in `erc-send-current-line'.
968
969To change the text inserted into the buffer without changing the text
970that will be sent, use `erc-send-modify-hook' instead.
971
972Filtering functions can set `erc-send-this' to nil to avoid sending of
973that particular string at all and `erc-insert-this' to prevent
974inserting that particular string into the buffer.
975
976Note that it's useless to set `erc-send-this' to nil and
977`erc-insert-this' to t. ERC is sane enough to not insert the text
978anyway."
979 :group 'erc-hooks
980 :type 'hook)
981
982(defvar erc-insert-this t
983 "Insert the text into the target buffer or not.
984Functions on `erc-insert-pre-hook' can set this variable to nil
985if they wish to avoid insertion of a particular string.")
986
987(defvar erc-send-this t
988 "Send the text to the target or not.
989Functions on `erc-send-pre-hook' can set this variable to nil
990if they wish to avoid sending of a particular string.")
991
992(defcustom erc-insert-modify-hook ()
993 "Insertion hook for functions that will change the text's appearance.
994This hook is called just after `erc-insert-pre-hook' when the value
995of `erc-insert-this' is t.
996While this hook is run, narrowing is in effect and `current-buffer' is
997the buffer where the text got inserted. One possible value to add here
998is `erc-fill'."
999 :group 'erc-hooks
1000 :type 'hook)
1001
1002(defcustom erc-insert-post-hook nil
1003 "This hook is called just after `erc-insert-modify-hook'.
1004At this point, all modifications from prior hook functions are done."
1005 :group 'erc-hooks
1006 :type 'hook
1007 :options '(erc-truncate-buffer
1008 erc-make-read-only
1009 erc-save-buffer-in-logs))
1010
1011(defcustom erc-send-modify-hook nil
1012 "Sending hook for functions that will change the text's appearance.
1013This hook is called just after `erc-send-pre-hook' when the values
1014of `erc-send-this' and `erc-insert-this' are both t.
1015While this hook is run, narrowing is in effect and `current-buffer' is
1016the buffer where the text got inserted.
1017
1018Note that no function in this hook can change the appearance of the
1019text that is sent. Only changing the sent text's appearance on the
1020sending user's screen is possible. One possible value to add here
1021is `erc-fill'."
1022 :group 'erc-hooks
1023 :type 'hook)
1024
1025(defcustom erc-send-post-hook nil
1026 "This hook is called just after `erc-send-modify-hook'.
1027At this point, all modifications from prior hook functions are done.
1028NOTE: The functions on this hook are called _before_ sending a command
1029to the server.
1030
1031This function is called with narrowing, ala `erc-send-modify-hook'"
1032 :group 'erc-hooks
1033 :type 'hook
1034 :options '(erc-make-read-only))
1035
1036(defcustom erc-send-completed-hook
1037 (when (featurep 'emacspeak)
1038 (list (byte-compile
1039 (lambda (str)
1040 (emacspeak-auditory-icon 'select-object)))))
1041 "Hook called after a message has been parsed by ERC.
1042
1043The single argument to the functions is the unmodified string
1044which the local user typed."
1045 :group 'erc-hooks
1046 :type 'hook)
1047;; mode-specific tables
1048
1049(defvar erc-mode-syntax-table
1050 (let ((syntax-table (make-syntax-table)))
1051 (modify-syntax-entry ?\" ". " syntax-table)
1052 (modify-syntax-entry ?\\ ". " syntax-table)
1053 (modify-syntax-entry ?' "w " syntax-table)
1054 ;; Make dabbrev-expand useful for nick names
1055 (modify-syntax-entry ?< "." syntax-table)
1056 (modify-syntax-entry ?> "." syntax-table)
1057 syntax-table)
1058 "Syntax table used while in ERC mode.")
1059
1060(defvar erc-mode-abbrev-table nil
1061 "Abbrev table used while in ERC mode.")
1062(define-abbrev-table 'erc-mode-abbrev-table ())
1063
1064(defvar erc-mode-map
1065 (let ((map (make-sparse-keymap)))
1066 (define-key map "\C-m" 'erc-send-current-line)
1067 (define-key map "\C-a" 'erc-bol)
1068 (define-key map [home] 'erc-bol)
1069 (define-key map "\C-c\C-a" 'erc-bol)
1070 (define-key map "\C-c\C-b" 'erc-iswitchb)
1071 (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls)
1072 (define-key map "\C-c\C-d" 'erc-input-action)
1073 (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
1074 (define-key map "\C-c\C-f" 'erc-toggle-flood-control)
1075 (define-key map "\C-c\C-i" 'erc-invite-only-mode)
1076 (define-key map "\C-c\C-j" 'erc-join-channel)
1077 (define-key map "\C-c\C-n" 'erc-channel-names)
1078 (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress)
1079 (define-key map "\C-c\C-p" 'erc-part-from-channel)
1080 (define-key map "\C-c\C-q" 'erc-quit-server)
1081 (define-key map "\C-c\C-r" 'erc-remove-text-properties-region)
1082 (define-key map "\C-c\C-t" 'erc-set-topic)
1083 (define-key map "\C-c\C-u" 'erc-kill-input)
1084 (define-key map "\M-\t" 'ispell-complete-word)
1085 (define-key map "\t" 'erc-complete-word)
1086
1087 ;; Suppress `font-lock-fontify-block' key binding since it
1088 ;; destroys face properties.
1089 (if (fboundp 'command-remapping)
1090 (define-key map [remap font-lock-fontify-block] 'undefined)
1091 (substitute-key-definition
1092 'font-lock-fontify-block 'undefined map global-map))
1093
1094 map)
1095 "ERC keymap.")
1096
1097;; Faces
1098
1099; Honestly, I have a horrible sense of color and the "defaults" below
1100; are supposed to be really bad. But colors ARE required in IRC to
1101; convey different parts of conversation. If you think you know better
1102; defaults - send them to me.
1103
1104;; Now colors are a bit nicer, at least to my eyes.
1105;; You may still want to change them to better fit your background.-- S.B.
1106
1107(defgroup erc-faces nil
1108 "Faces for ERC."
1109 :group 'erc)
1110
1111(defface erc-default-face '((t))
1112 "ERC default face."
1113 :group 'erc-faces)
1114
1115(defface erc-direct-msg-face '((t (:foreground "IndianRed")))
1116 "ERC face used for messages you receive in the main erc buffer."
1117 :group 'erc-faces)
1118
1119(defface erc-input-face '((t (:foreground "brown")))
1120 "ERC face used for your input."
1121 :group 'erc-faces)
1122
1123(defface erc-prompt-face
1124 '((t (:bold t :foreground "Black" :background"lightBlue2")))
1125 "ERC face for the prompt."
1126 :group 'erc-faces)
1127
1128(defface erc-command-indicator-face
1129 '((t (:bold t)))
1130 "ERC face for the command indicator.
1131See the variable `erc-command-indicator'."
1132 :group 'erc-faces)
1133
1134(defface erc-notice-face '((t (:bold t :foreground "SlateBlue")))
1135 "ERC face for notices."
1136 :group 'erc-faces)
1137
1138(defface erc-action-face '((t (:bold t)))
1139 "ERC face for actions generated by /ME."
1140 :group 'erc-faces)
1141
1142(defface erc-error-face '((t (:foreground "red")))
1143 "ERC face for errors."
1144 :group 'erc-faces)
1145
1146(defface erc-nick-default-face '((t (:bold t)))
1147 "ERC nickname default face."
1148 :group 'erc-faces)
1149
1150(defface erc-nick-msg-face '((t (:bold t :foreground "IndianRed")))
1151 "ERC nickname face for private messages."
1152 :group 'erc-faces)
1153
1154;; Debugging support
1155
1156(defvar erc-log-p nil
1157 "When set to t, generate debug messages in a separate debug buffer.")
1158
1159(defvar erc-debug-log-file (expand-file-name "ERC.debug")
1160 "Debug log file name.")
1161
1162(defvar erc-dbuf nil)
1163(make-variable-buffer-local 'erc-dbuf)
1164
1165(defmacro define-erc-module (name alias doc enable-body disable-body
1166 &optional local-p)
1167 "Define a new minor mode using ERC conventions.
1168Symbol NAME is the name of the module.
1169Symbol ALIAS is the alias to use, or nil.
1170DOC is the documentation string to use for the minor mode.
1171ENABLE-BODY is a list of expressions used to enable the mode.
1172DISABLE-BODY is a list of expressions used to disable the mode.
1173If LOCAL-P is non-nil, the mode will be created as a buffer-local
1174mode. Rather than a global one.
1175
1176This will define a minor mode called erc-NAME-mode, possibly
1177an alias erc-ALIAS-mode, as well as the helper functions
1178erc-NAME-enable, and erc-NAME-disable.
1179
1180Example:
1181
1182 ;;;###autoload (autoload 'erc-replace-mode \"erc-replace\")
1183 (define-erc-module replace nil
1184 \"This mode replaces incoming text according to `erc-replace-alist'.\"
1185 ((add-hook 'erc-insert-modify-hook
1186 'erc-replace-insert))
1187 ((remove-hook 'erc-insert-modify-hook
1188 'erc-replace-insert)))"
1189 (let* ((sn (symbol-name name))
1190 (mode (intern (format "erc-%s-mode" (downcase sn))))
1191 (group (intern (format "erc-%s" (downcase sn))))
1192 (enable (intern (format "erc-%s-enable" (downcase sn))))
1193 (disable (intern (format "erc-%s-disable" (downcase sn)))))
1194 `(progn
1195 (erc-define-minor-mode
1196 ,mode
1197 ,(format "Toggle ERC %S mode.
1198With arg, turn ERC %S mode on if and only if arg is positive.
1199%s" name name doc)
1200 nil nil nil
1201 :global ,(not local-p) :group (quote ,group)
1202 (if ,mode
1203 (,enable)
1204 (,disable)))
1205 (defun ,enable ()
1206 ,(format "Enable ERC %S mode."
1207 name)
1208 (interactive)
1209 (add-to-list 'erc-modules (quote ,name))
1210 (setq ,mode t)
1211 ,@enable-body)
1212 (defun ,disable ()
1213 ,(format "Disable ERC %S mode."
1214 name)
1215 (interactive)
1216 (setq erc-modules (delq (quote ,name) erc-modules))
1217 (setq ,mode nil)
1218 ,@disable-body)
1219 ,(when (and alias (not (eq name alias)))
1220 `(defalias
1221 (quote
1222 ,(intern
1223 (format "erc-%s-mode"
1224 (downcase (symbol-name alias)))))
1225 (quote
1226 ,mode))))))
1227
1228(put 'define-erc-module 'doc-string-elt 3)
1229
1230(defun erc-once-with-server-event (event &rest forms)
1231 "Execute FORMS the next time EVENT occurs in the `current-buffer'.
1232
1233You should make sure that `current-buffer' is a server buffer.
1234
1235This function temporarily adds a function to EVENT's hook to
1236execute FORMS. After FORMS are run, the function is removed from
1237EVENT's hook. The last expression of FORMS should be either nil
1238or t. nil indicates that the other functions on EVENT's hook
1239should be run too, and t indicates that other functions should
1240not be run.
1241
1242Please be sure to use this function in server-buffers. In
1243channel-buffers it may not work at all, as it uses the LOCAL
1244argument of `add-hook' and `remove-hook' to ensure multiserver
1245capabilities."
1246 (unless (erc-server-buffer-p)
1247 (error
1248 "You should only run `erc-once-with-server-event' in a server buffer"))
1249 (let ((fun (erc-gensym))
1250 (hook (erc-get-hook event)))
1251 (put fun 'erc-original-buffer (current-buffer))
1252 (fset fun `(lambda (proc parsed)
1253 (with-current-buffer (get ',fun 'erc-original-buffer)
1254 (remove-hook ',hook ',fun t))
1255 (fmakunbound ',fun)
1256 ,@forms))
1257 (add-hook hook fun nil t)
1258 fun))
1259
1260(defun erc-once-with-server-event-global (event &rest forms)
1261 "Execute FORMS the next time EVENT occurs in any server buffer.
1262
1263This function temporarily prepends a function to EVENT's hook to
1264execute FORMS. After FORMS are run, the function is removed from
1265EVENT's hook. The last expression of FORMS should be either nil
1266or t. nil indicates that the other functions on EVENT's hook
1267should be run too, and t indicates that other functions should
1268not be run.
1269
1270When FORMS execute, the current buffer is the server buffer associated with the
1271connection over which the data was received that triggered EVENT."
1272 (let ((fun (erc-gensym))
1273 (hook (erc-get-hook event)))
1274 (fset fun `(lambda (proc parsed)
1275 (remove-hook ',hook ',fun)
1276 (fmakunbound ',fun)
1277 ,@forms))
1278 (add-hook hook fun nil nil)
1279 fun))
1280
1281(defmacro erc-log (string)
1282 "Logs STRING if logging is on (see `erc-log-p')."
1283 `(when erc-log-p
1284 (erc-log-aux ,string)))
1285
1286(defun erc-server-buffer ()
1287 "Return the server buffer for the current buffer's process.
1288The buffer-local variable `erc-server-process' is used to find
1289the process buffer."
1290 (and (erc-server-buffer-live-p)
1291 (process-buffer erc-server-process)))
1292
1293(defun erc-server-buffer-live-p ()
1294 "Return t if the buffer associated with `erc-server-process'
1295has not been killed."
1296 (and (processp erc-server-process)
1297 (buffer-live-p (process-buffer erc-server-process))))
1298
1299(defun erc-server-buffer-p (&optional buffer)
1300 "Return non-nil if argument BUFFER is an ERC server buffer.
1301
1302If BUFFER is nil, the current buffer is used."
1303 (with-current-buffer (or buffer (current-buffer))
1304 (and (eq major-mode 'erc-mode)
1305 (null (erc-default-target)))))
1306
1307(defun erc-query-buffer-p (&optional buffer)
1308 "Return non-nil if BUFFER is an ERC query buffer.
1309If BUFFER is nil, the current buffer is used."
1310 (with-current-buffer (or buffer (current-buffer))
1311 (let ((target (erc-default-target)))
1312 (and (eq major-mode 'erc-mode)
1313 target
1314 (not (memq (aref target 0) '(?# ?& ?+ ?!)))))))
1315
1316(defun erc-ison-p (nick)
1317 "Return non-nil if NICK is online."
1318 (interactive "sNick: ")
1319 (with-current-buffer (erc-server-buffer)
1320 (let ((erc-online-p 'unknown))
1321 (erc-once-with-server-event
1322 303
1323 `(let ((ison (split-string (aref parsed 3))))
1324 (setq erc-online-p (car (erc-member-ignore-case ,nick ison)))
1325 t))
1326 (erc-server-send (format "ISON %s" nick))
1327 (while (eq erc-online-p 'unknown) (accept-process-output))
1328 (if (interactive-p)
1329 (message "%s is %sonline"
1330 (or erc-online-p nick)
1331 (if erc-online-p "" "not "))
1332 erc-online-p))))
1333
1334(defun erc-log-aux (string)
1335 "Do the debug logging of STRING."
1336 (let ((cb (current-buffer))
1337 (point 1)
1338 (was-eob nil)
1339 (session-buffer (erc-server-buffer)))
1340 (if session-buffer
1341 (progn
1342 (set-buffer session-buffer)
1343 (if (not (and erc-dbuf (bufferp erc-dbuf) (buffer-live-p erc-dbuf)))
1344 (progn
1345 (setq erc-dbuf (get-buffer-create
1346 (concat "*ERC-DEBUG: "
1347 erc-session-server "*")))))
1348 (set-buffer erc-dbuf)
1349 (setq point (point))
1350 (setq was-eob (eobp))
1351 (goto-char (point-max))
1352 (insert (concat "** " string "\n"))
1353 (if was-eob (goto-char (point-max))
1354 (goto-char point))
1355 (set-buffer cb))
1356 (message "ERC: ** %s" string))))
1357
1358;; Last active buffer, to print server messages in the right place
1359
1360(defvar erc-active-buffer nil
1361 "The current active buffer, the one where the user typed the last command.
1362Defaults to the server buffer, and should only be set in the
1363server buffer")
1364(make-variable-buffer-local 'erc-active-buffer)
1365
1366(defun erc-active-buffer ()
1367 "Return the value of `erc-active-buffer' for the current server.
1368Defaults to the server buffer."
1369 (with-current-buffer (erc-server-buffer) erc-active-buffer))
1370
1371(defun erc-set-active-buffer (buffer)
1372 "Set the value of `erc-active-buffer' to BUFFER."
1373 (cond ((erc-server-buffer)
1374 (with-current-buffer (erc-server-buffer)
1375 (setq erc-active-buffer buffer)))
1376 (t (setq erc-active-buffer buffer))))
1377
1378;; Mode activation routines
1379
1380(defun erc-mode ()
1381 "Major mode for Emacs IRC.
1382Special commands:
1383
1384\\{erc-mode-map}
1385
1386Turning on `erc-mode' runs the hook `erc-mode-hook'."
1387 (kill-all-local-variables)
1388 (use-local-map erc-mode-map)
1389 (setq mode-name "ERC"
1390 major-mode 'erc-mode
1391 local-abbrev-table erc-mode-abbrev-table)
1392 (set-syntax-table erc-mode-syntax-table)
1393 (when (boundp 'next-line-add-newlines)
1394 (set (make-local-variable 'next-line-add-newlines) nil))
1395 (setq line-move-ignore-invisible t)
1396 (set (make-local-variable 'paragraph-separate)
1397 (concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)"))
1398 (set (make-local-variable 'paragraph-start)
1399 (concat "\\(" (regexp-quote (erc-prompt)) "\\)"))
1400 ;; Run the mode hooks
1401 (run-hooks 'erc-mode-hook))
1402
1403;; activation
1404
1405(defconst erc-default-server "irc.freenode.net"
1406 "IRC server to use if it cannot be detected otherwise.")
1407
1408(defconst erc-default-port "ircd"
1409 "IRC port to use if it cannot be detected otherwise.")
1410
1411(defcustom erc-join-buffer 'buffer
1412 "Determines how to display the newly created IRC buffer.
1413'window - in another window,
1414'window-noselect - in another window, but don't select that one,
1415'frame - in another frame,
1416'bury - bury it in a new buffer,
1417any other value - in place of the current buffer"
1418 :group 'erc-buffers
1419 :type '(choice (const window)
1420 (const window-noselect)
1421 (const frame)
1422 (const bury)
1423 (const buffer)))
1424
1425(defcustom erc-frame-alist nil
1426 "*Alist of frame parameters for creating erc frames.
1427A value of `nil means to use `default-frame-alist'."
1428 :group 'erc-buffers
1429 :type '(repeat (cons :format "%v"
1430 (symbol :tag "Parameter")
1431 (sexp :tag "Value"))))
1432
1433(defcustom erc-frame-dedicated-flag nil
1434 "*Non-nil means the erc frames are dedicated to that buffer.
1435This only has effect when `erc-join-buffer' is set to `frame'."
1436 :group 'erc-buffers
1437 :type 'boolean)
1438
1439(defun erc-channel-p (channel)
1440 "Return non-nil if CHANNEL seems to be an IRC channel name."
1441 (cond ((stringp channel)
1442 (memq (aref channel 0) '(?# ?& ?+ ?!)))
1443 ((and (bufferp channel) (buffer-live-p channel))
1444 (with-current-buffer channel
1445 (erc-channel-p (erc-default-target))))
1446 (t nil)))
1447
1448(defcustom erc-reuse-buffers t
1449 "*If nil, create new buffers on joining a channel/query.
1450If non-nil, a new buffer will only be created when you join
1451channels with same names on different servers, or have query buffers
1452open with nicks of the same name on different servers. Otherwise,
1453the existing buffers will be reused."
1454 :group 'erc-buffers
1455 :type 'boolean)
1456
1457(defun erc-normalize-port (port)
1458 "Normalize the port specification PORT to integer form.
1459PORT may be an integer, a string or a symbol. If it is a string or a
1460symbol, it may have these values:
1461* irc -> 194
1462* ircs -> 994
1463* ircd -> 6667
1464* ircd-dalnet -> 7000"
1465 (cond
1466 ((symbolp port)
1467 (erc-normalize-port (symbol-name port)))
1468 ((stringp port)
1469 (let ((port-nr (string-to-number port)))
1470 (cond
1471 ((> port-nr 0)
1472 port-nr)
1473 ((string-equal port "irc")
1474 194)
1475 ((string-equal port "ircs")
1476 994)
1477 ((string-equal port "ircd")
1478 6667)
1479 ((string-equal port "ircd-dalnet")
1480 7000)
1481 (t
1482 nil))))
1483 ((numberp port)
1484 port)
1485 (t
1486 nil)))
1487
1488(defun erc-port-equal (a b)
1489 "Check whether ports A and B are equal."
1490 (= (erc-normalize-port a) (erc-normalize-port b)))
1491
1492(defun erc-generate-new-buffer-name (server port target &optional proc)
1493 "Create a new buffer name based on the arguments."
1494 (when (numberp port) (setq port (number-to-string port)))
1495 (let* ((buf-name (or target
1496 (or (let ((name (concat server ":" port)))
1497 (when (> (length name) 1)
1498 name))
1499 ; This fallback should in fact never happen
1500 "*erc-server-buffer*"))))
1501 ;; Reuse existing buffers, but not if the buffer is a connected server
1502 ;; buffer and not if its associated with a different server than the
1503 ;; current ERC buffer.
1504 (if (and erc-reuse-buffers
1505 (get-buffer buf-name)
1506 (or target
1507 (with-current-buffer (get-buffer buf-name)
1508 (and (erc-server-buffer-p)
1509 (not erc-server-connected))))
1510 (with-current-buffer (get-buffer buf-name)
1511 (and (string= erc-session-server server)
1512 (erc-port-equal erc-session-port port))))
1513 buf-name
1514 (generate-new-buffer-name buf-name))))
1515
1516(defun erc-get-buffer-create (server port target &optional proc)
1517 "Create a new buffer based on the arguments."
1518 (get-buffer-create (erc-generate-new-buffer-name server port target proc)))
1519
1520
1521(defun erc-member-ignore-case (string list)
1522 "Return non-nil if STRING is a member of LIST.
1523
1524All strings are compared according to IRC protocol case rules, see
1525`erc-downcase'."
1526 (setq string (erc-downcase string))
1527 (catch 'result
1528 (while list
1529 (if (string= string (erc-downcase (car list)))
1530 (throw 'result list) (setq list (cdr list))))))
1531
1532(defmacro erc-with-buffer (spec &rest body)
1533 "Execute BODY in the buffer associated with SPEC.
1534
1535SPEC should have the form
1536
1537 (TARGET [PROCESS])
1538
1539If TARGET is a buffer, use it. Otherwise, use the buffer
1540matching TARGET in the process specified by PROCESS.
1541
1542If PROCESS is nil, use the current `erc-server-process'
1543See `erc-get-buffer' for details.
1544
1545See also `with-current-buffer'.
1546
1547\(fn (TARGET [PROCESS]) BODY...)"
1548 (let ((buf (erc-gensym))
1549 (proc (erc-gensym))
1550 (target (erc-gensym))
1551 (process (erc-gensym)))
1552 `(let* ((,target ,(car spec))
1553 (,process ,(cadr spec))
1554 (,buf (if (bufferp ,target)
1555 ,target
1556 (let ((,proc (or ,process
1557 (and (processp erc-server-process)
1558 erc-server-process))))
1559 (if (and ,target ,proc)
1560 (erc-get-buffer ,target ,proc))))))
1561 (when ,buf
1562 (with-current-buffer ,buf
1563 ,@body)))))
1564(put 'erc-with-buffer 'lisp-indent-function 1)
1565(put 'erc-with-buffer 'edebug-form-spec '((form &optional form) body))
1566
1567(defun erc-get-buffer (target &optional proc)
1568 "Return the buffer matching TARGET in the process PROC.
1569If PROC is not supplied, all processes are searched."
1570 (let ((downcased-target (erc-downcase target)))
1571 (catch 'buffer
1572 (erc-buffer-filter
1573 (lambda ()
1574 (let ((current (erc-default-target)))
1575 (and (stringp current)
1576 (string-equal downcased-target (erc-downcase current))
1577 (throw 'buffer (current-buffer)))))
1578 proc))))
1579
1580(defun erc-buffer-filter (predicate &optional proc)
1581 "Return a list of `erc-mode' buffers matching certain criteria.
1582PREDICATE is a function executed with each buffer, if it returns t, that buffer
1583is considered a valid match.
1584
1585PROC is either an `erc-server-process', identifying a certain
1586server connection, or nil which means all open connections."
1587 (save-excursion
1588 (delq
1589 nil
1590 (mapcar (lambda (buf)
1591 (with-current-buffer buf
1592 (and (eq major-mode 'erc-mode)
1593 (or (not proc)
1594 (eq proc erc-server-process))
1595 (funcall predicate)
1596 buf)))
1597 (buffer-list)))))
1598
1599(defun erc-buffer-list (&optional predicate proc)
1600 "Return a list of ERC buffers.
1601PREDICATE is a function which executes with every buffer satisfying
1602the predicate. If PREDICATE is passed as nil, return a list of all ERC
1603buffers. If PROC is given, the buffers local variable `erc-server-process'
1604needs to match PROC."
1605 (unless predicate
1606 (setq predicate (lambda () t)))
1607 (erc-buffer-filter predicate proc))
1608
1609(defmacro erc-with-all-buffers-of-server (process pred &rest forms)
1610 "Execute FORMS in all buffers which have same process as this server.
1611FORMS will be evaluated in all buffers having the process PROCESS and
1612where PRED matches or in all buffers of the server process if PRED is
1613nil."
1614 ;; Make the evaluation have the correct order
1615 (let ((pre (erc-gensym))
1616 (pro (erc-gensym)))
1617 `(let ((,pro ,process)
1618 (,pre ,pred))
1619 (mapcar (lambda (buffer)
1620 (with-current-buffer buffer
1621 ,@forms))
1622 (erc-buffer-list ,pre
1623 ,pro)))))
1624(put 'erc-with-all-buffers-of-server 'lisp-indent-function 1)
1625(put 'erc-with-all-buffers-of-server 'edebug-form-spec '(form form body))
1626
1627(defun erc-iswitchb (&optional arg)
1628 "Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to.
1629When invoked with prefix argument, use all erc buffers. Without prefix
1630ARG, allow only buffers related to same session server.
1631If `erc-track-mode' is in enabled, put the last element of
1632`erc-modified-channels-alist' in front of the buffer list.
1633
1634Due to some yet unresolved reason, global function `iswitchb-mode'
1635needs to be active for this function to work."
1636 (interactive "P")
1637 (eval-when-compile
1638 (require 'iswitchb))
1639 (let ((iswitchb-make-buflist-hook
1640 (lambda ()
1641 (setq iswitchb-temp-buflist
1642 (mapcar 'buffer-name
1643 (erc-buffer-list
1644 nil
1645 (when (and arg (boundp 'erc-server-process))
1646 erc-server-process)))))))
1647 (switch-to-buffer
1648 (iswitchb-read-buffer
1649 "Switch-to: "
1650 (if (boundp 'erc-modified-channels-alist)
1651 (buffer-name (caar (last erc-modified-channels-alist)))
1652 nil)
1653 t))))
1654
1655(defun erc-channel-list (proc)
1656 "Return a list of channel buffers.
1657PROC is the process for the server connection. If PROC is nil, return
1658all channel buffers on all servers."
1659 (erc-buffer-filter
1660 (lambda ()
1661 (and (erc-default-target)
1662 (erc-channel-p (erc-default-target))))
1663 proc))
1664
1665(defun erc-buffer-list-with-nick (nick proc)
1666 "Return buffers containing NICK in the `erc-channel-users' list."
1667 (with-current-buffer (process-buffer proc)
1668 (let ((user (gethash (erc-downcase nick) erc-server-users)))
1669 (if user
1670 (erc-server-user-buffers user)
1671 nil))))
1672
1673;; Some local variables
1674
1675(defvar erc-default-recipients nil
1676 "List of default recipients of the current buffer.")
1677(make-variable-buffer-local 'erc-default-recipients)
1678
1679(defvar erc-session-user-full-name nil
1680 "Full name of the user on the current server.")
1681(make-variable-buffer-local 'erc-session-user-full-name)
1682
1683(defvar erc-channel-user-limit nil
1684 "Limit of users per channel.")
1685(make-variable-buffer-local 'erc-channel-user-limit)
1686
1687(defvar erc-channel-key nil
1688 "Key needed to join channel.")
1689(make-variable-buffer-local 'erc-channel-key)
1690
1691(defvar erc-invitation nil
1692 "Last invitation channel.")
1693(make-variable-buffer-local 'erc-invitation)
1694
1695(defvar erc-away nil
1696 "Non-nil indicates that we are away.")
1697(make-variable-buffer-local 'erc-away)
1698
1699(defvar erc-channel-list nil
1700 "Server channel list.")
1701(make-variable-buffer-local 'erc-channel-list)
1702
1703(defvar erc-bad-nick nil
1704 "Non-nil indicates that we got a `nick in use' error while connecting.")
1705(make-variable-buffer-local 'erc-bad-nick)
1706
1707(defvar erc-logged-in nil
1708 "Non-nil indicates that we are logged in.")
1709(make-variable-buffer-local 'erc-logged-in)
1710
1711(defvar erc-default-nicks nil
1712 "The local copy of `erc-nick' - the list of nicks to choose from.")
1713(make-variable-buffer-local 'erc-default-nicks)
1714
1715(defvar erc-nick-change-attempt-count 0
1716 "Used to keep track of how many times an attempt at changing nick is made.")
1717(make-variable-buffer-local 'erc-nick-change-attempt-count)
1718
1719(defcustom erc-modules '(netsplit fill button match track pcomplete readonly
1720 ring autojoin noncommands irccontrols
1721 stamp)
1722 "A list of modules which erc should enable.
1723If you set the value of this without using `customize' remember to call
1724\(erc-update-modules) after you change it. When using `customize', modules
1725removed from the list will be disabled."
1726 :set (lambda (sym val)
1727 ;; disable modules which have just been removed
1728 (when (and (boundp 'erc-modules) erc-modules val)
1729 (dolist (module erc-modules)
1730 (unless (member module val)
1731 (let ((f (intern-soft (format "erc-%s-mode" module))))
1732 (when (and (fboundp f) (boundp f) (symbol-value f))
1733 (message "Disabling `erc-%s'" module)
1734 (funcall f 0))))))
1735 (set-default sym val)
1736 ;; this test is for the case where erc hasn't been loaded yet
1737 (when (fboundp 'erc-update-modules)
1738 (erc-update-modules)))
1739 :type '(set :greedy t
1740 (const :tag "Set away status automatically" autoaway)
1741 (const :tag "Join channels automatically" autojoin)
1742 (const :tag "Integrate with Big Brother Database" bbdb)
1743 (const :tag "Buttonize URLs, nicknames, and other text" button)
1744 (const :tag "Wrap long lines" fill)
1745 (const :tag "Highlight or remove IRC control characters"
1746 irccontrols)
1747 (const :tag "Save buffers in logs" log)
1748 (const :tag "Highlight pals, fools, and other keywords" match)
1749 (const :tag "Detect netsplits" netsplit)
1750 (const :tag "Don't display non-IRC commands after evaluation"
1751 noncommands)
1752 (const :tag
1753 "Notify when the online status of certain users changes"
1754 notify)
1755 (const :tag "Complete nicknames and commands (programmable)"
1756 pcomplete)
1757 (const :tag "Complete nicknames and commands (old)" completion)
1758 (const :tag "Make displayed lines read-only" readonly)
1759 (const :tag "Replace text in messages" replace)
1760 (const :tag "Enable an input history" ring)
1761 (const :tag "Scroll to the bottom of the buffer" scrolltobottom)
1762 (const :tag "Identify to Nickserv (IRC Services) automatically"
1763 services)
1764 (const :tag "Convert smileys to pretty icons" smiley)
1765 (const :tag "Play sounds when you receive CTCP SOUND requests"
1766 sound)
1767 (const :tag "Add timestamps to messages" stamp)
1768 (const :tag "Check spelling" spelling)
1769 (const :tag "Track channel activity in the mode-line" track)
1770 (const :tag "Truncate buffers to a certain size" truncate)
1771 (const :tag "Translate morse code in messages" unmorse)
1772 (repeat :tag "Others" :inline t symbol))
1773 :group 'erc)
1774
1775(defun erc-update-modules ()
1776 "Run this to enable erc-foo-mode for all modules in `erc-modules'."
1777 (let (req)
1778 (dolist (mod erc-modules)
1779 (setq req (concat "erc-" (symbol-name mod)))
1780 (cond
1781 ;; yuck. perhaps we should bring the filenames into sync?
1782 ((string= req "erc-completion")
1783 (setq req "erc-pcomplete")
1784 (setq mod 'pcomplete))
1785 ((string= req "erc-services")
1786 (setq req "erc-nickserv")
1787 (setq mod 'services)))
1788 (condition-case nil
1789 (require (intern req))
1790 (error nil))
1791 (funcall (or (intern-soft (concat "erc-" (symbol-name mod) "-mode"))
1792 (error "`%s' is not a known ERC module" mod))
1793 1))))
1794
1795(defun erc-setup-buffer (buffer)
1796 "Consults `erc-join-buffer' to find out how to display `BUFFER'."
1797 (cond ((eq erc-join-buffer 'window)
1798 (if (active-minibuffer-window)
1799 (display-buffer buffer)
1800 (switch-to-buffer-other-window buffer)))
1801 ((eq erc-join-buffer 'window-noselect)
1802 (display-buffer buffer))
1803 ((eq erc-join-buffer 'bury)
1804 nil)
1805 ((eq erc-join-buffer 'frame)
1806 (funcall '(lambda (frame)
1807 (raise-frame frame)
1808 (select-frame frame))
1809 (make-frame (or erc-frame-alist
1810 default-frame-alist)))
1811 (switch-to-buffer buffer)
1812 (when erc-frame-dedicated-flag
1813 (set-window-dedicated-p (selected-window) t)))
1814 (t
1815 (if (active-minibuffer-window)
1816 (display-buffer buffer)
1817 (switch-to-buffer buffer)))))
1818
1819(defun erc (&optional server port nick full-name
1820 connect passwd tgt-list channel process)
1821 "ERC is a powerful, modular, and extensible IRC client.
1822
1823Connect to SERVER on PORT as NICK with FULL-NAME.
1824
1825If CONNECT is non-nil, connect to the server. Otherwise assume
1826already connected and just create a separate buffer for the new
1827target CHANNEL.
1828
1829Use PASSWD as user password on the server. If TGT-LIST is
1830non-nil, use it to initialise `erc-default-recipients'.
1831
1832Returns the buffer for the given server or channel."
1833 (let ((server-announced-name (when (and (boundp 'erc-session-server)
1834 (string= server erc-session-server))
1835 erc-server-announced-name))
1836 (connected-p (unless connect erc-server-connected))
1837 (buffer (erc-get-buffer-create server port channel))
1838 (old-buffer (current-buffer))
1839 continued-session)
1840 (erc-update-modules)
1841 (set-buffer buffer)
1842 (erc-mode)
1843 (setq erc-server-announced-name server-announced-name)
1844 (setq erc-server-connected connected-p)
1845 ;; connection parameters
1846 (setq erc-server-process process)
1847 (setq erc-insert-marker (make-marker))
1848 (setq erc-input-marker (make-marker))
1849 ;; go to the end of the buffer and open a new line
1850 ;; (the buffer may have existed)
1851 (goto-char (point-max))
1852 (forward-line 0)
1853 (when (get-text-property (point) 'erc-prompt)
1854 (setq continued-session t)
1855 (set-marker erc-input-marker
1856 (or (next-single-property-change (point) 'erc-prompt)
1857 (point-max))))
1858 (unless continued-session
1859 (goto-char (point-max))
1860 (insert "\n"))
1861 (set-marker erc-insert-marker (point))
1862 ;; stack of default recipients
1863 (setq erc-default-recipients tgt-list)
1864 (setq erc-server-current-nick nil)
1865 ;; Initialize erc-server-users and erc-channel-users
1866 (if connect
1867 (progn ;; server buffer
1868 (setq erc-server-users
1869 (make-hash-table :test 'equal))
1870 (setq erc-channel-users nil))
1871 (progn ;; target buffer
1872 (setq erc-server-users nil)
1873 (setq erc-channel-users
1874 (make-hash-table :test 'equal))))
1875 ;; clear last incomplete line read
1876 (setq erc-server-filter-data nil)
1877 (setq erc-channel-topic "")
1878 ;; limit on the number of users on the channel (mode +l)
1879 (setq erc-channel-user-limit nil)
1880 (setq erc-channel-key nil)
1881 ;; last active buffer, defaults to this one
1882 (erc-set-active-buffer buffer)
1883 ;; last invitation channel
1884 (setq erc-invitation nil)
1885 ;; away flag
1886 ;; Should only be used in session-buffers
1887 (setq erc-away (let ((serverbuf (erc-server-buffer)))
1888 (and serverbuf (with-current-buffer serverbuf erc-away))))
1889 ;; Server channel list
1890 (setq erc-channel-list ())
1891 ;; login-time 'nick in use' error
1892 (setq erc-bad-nick nil)
1893 ;; whether we have logged in
1894 (setq erc-logged-in nil)
1895 ;; The local copy of `erc-nick' - the list of nicks to choose
1896 (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
1897 ;; password stuff
1898 (setq erc-session-password passwd)
1899 ;; debug output buffer
1900 (setq erc-dbuf
1901 (when erc-log-p
1902 (get-buffer-create (concat "*ERC-DEBUG: " server "*"))))
1903 (erc-determine-parameters server port nick full-name)
1904
1905 ;; Saving log file on exit
1906 (run-hooks 'erc-connect-pre-hook)
1907
1908 (when connect
1909 (erc-server-connect erc-session-server erc-session-port))
1910 (erc-update-mode-line)
1911 (set-marker erc-insert-marker (point))
1912 (unless continued-session
1913 (goto-char (point-max))
1914 (insert "\n"))
1915 (set-marker (process-mark erc-server-process) (point))
1916 (unless continued-session
1917 (set-marker erc-insert-marker (point))
1918 (erc-display-prompt)
1919 (goto-char (point-max)))
1920
1921 ;; Now display the buffer in a window as per user wishes.
1922 (unless (eq buffer old-buffer)
1923 (when erc-log-p
1924 ;; we can't log to debug buffer, it may not exist yet
1925 (message "erc: old buffer %s, switching to %s"
1926 old-buffer buffer))
1927 (erc-setup-buffer buffer))
1928
1929 buffer))
1930
1931(defun erc-initialize-log-marker ()
1932 "Initialize the `erc-last-saved-position' marker to a sensible position."
1933 (setq erc-last-saved-position (make-marker))
1934 (move-marker erc-last-saved-position
1935 (1- (marker-position erc-insert-marker))))
1936
1937;; interactive startup
1938
1939(defvar erc-server-history-list nil
1940 "IRC server interactive selection history list.")
1941
1942(defvar erc-nick-history-list nil
1943 "Nickname interactive selection history list.")
1944
1945(defun erc-already-logged-in (server port nick)
1946 "Return the buffers corresponding to a NICK on PORT of a session SERVER.
1947This is determined by looking for the appropriate buffer and checking
1948whether the connection is still alive.
1949If no buffer matches, return nil."
1950 (erc-buffer-list
1951 (lambda ()
1952 (and (erc-server-process-alive)
1953 (string= erc-session-server server)
1954 (erc-port-equal erc-session-port port)
1955 (erc-current-nick-p nick)))))
1956
1957(if (not (fboundp 'read-passwd))
1958 (defun read-passwd (prompt)
1959 "Substitute for read-passwd in early emacsen"
1960 (read-from-minibuffer prompt)))
1961
1962(defcustom erc-before-connect nil
1963 "Hook called before connecting to a server.
1964This hook gets executed before `erc-select' actually invokes `erc-mode'
1965with your input data. The functions in here get called with three
1966parameters, SERVER, PORT and NICK."
1967 :group 'erc-hooks
1968 :type 'hook)
1969
1970(defcustom erc-after-connect nil
1971 "Hook called after connecting to a server.
1972This hook gets executed when an end of MOTD has been received. All
1973functions in here get called with the parameters SERVER and NICK."
1974 :group 'erc-hooks
1975 :type 'hook)
1976
1977;;;###autoload
1978(defun erc-select-read-args ()
1979 "Prompt the user for values of nick, server, port, and password."
1980 (let (user-input server port nick passwd)
1981 (setq user-input (read-from-minibuffer
1982 "IRC server: "
1983 (erc-compute-server) nil nil 'erc-server-history-list))
1984
1985 (if (string-match "\\(.*\\):\\(.*\\)\\'" user-input)
1986 (setq port (erc-string-to-port (match-string 2 user-input))
1987 user-input (match-string 1 user-input))
1988 (setq port
1989 (erc-string-to-port (read-from-minibuffer
1990 "IRC port: " (erc-port-to-string
1991 (erc-compute-port))))))
1992
1993 (if (string-match "\\`\\(.*\\)@\\(.*\\)" user-input)
1994 (setq nick (match-string 1 user-input)
1995 user-input (match-string 2 user-input))
1996 (setq nick
1997 (if (erc-already-logged-in server port nick)
1998 (read-from-minibuffer
1999 (erc-format-message 'nick-in-use ?n nick)
2000 nick
2001 nil nil 'erc-nick-history-list)
2002 (read-from-minibuffer
2003 "Nickname: " (erc-compute-nick nick)
2004 nil nil 'erc-nick-history-list))))
2005
2006 (setq server user-input)
2007
2008 (setq passwd (if erc-prompt-for-password
2009 (if (and erc-password
2010 (y-or-n-p "Use the default password? "))
2011 erc-password
2012 (read-passwd "Password: "))
2013 erc-password))
2014 (when (and passwd (string= "" passwd))
2015 (setq passwd nil))
2016
2017 (while (erc-already-logged-in server port nick)
2018 ;; hmm, this is a problem when using multiple connections to a bnc
2019 ;; with the same nick. Currently this code prevents using more than one
2020 ;; bnc with the same nick. actually it would be nice to have
2021 ;; bncs transparent, so that erc-compute-buffer-name displays
2022 ;; the server one is connected to.
2023 (setq nick (read-from-minibuffer
2024 (erc-format-message 'nick-in-use ?n nick)
2025 nick
2026 nil nil 'erc-nick-history-list)))
2027 (list :server server :port port :nick nick :password passwd)))
2028
2029;;;###autoload
2030(defun* erc-select (&key (server (erc-compute-server))
2031 (port (erc-compute-port))
2032 (nick (erc-compute-nick))
2033 password
2034 (full-name (erc-compute-full-name)))
2035 "Select connection parameters and run ERC.
2036Non-interactively, it takes keyword arguments
2037 (server (erc-compute-server))
2038 (port (erc-compute-port))
2039 (nick (erc-compute-nick))
2040 password
2041 (full-name (erc-compute-full-name)))
2042
2043That is, if called with
2044 (erc-select :server \"irc.freenode.net\" :full-name \"Harry S Truman\")
2045server and full-name will be set to those values, whereas
2046erc-compute-port, erc-compute-nick and erc-compute-full-name will
2047be invoked for those parameters' values"
2048 (interactive (erc-select-read-args))
2049
2050 (run-hook-with-args 'erc-before-connect server port nick)
2051 (erc server port nick erc-user-full-name t password))
2052
2053
2054(defun erc-select-ssl (&rest r)
2055 "Interactively select SSL connection parameters and run ERC.
2056Arguments are as to erc-select."
2057 (interactive (erc-select-read-args))
2058 (let ((erc-server-connect-function 'erc-open-ssl-stream))
2059 (apply 'erc-select r)))
2060
2061(defun erc-open-ssl-stream (name buffer host port)
2062 "Open an SSL stream to an IRC server.
2063The process will be given the name NAME, its target buffer will be
2064BUFFER. HOST and PORT specify the connection target."
2065 (when (require 'ssl)
2066 (let ((proc (open-ssl-stream name buffer host port)))
2067 ;; Ugly hack, but it works for now. Problem is it is
2068 ;; very hard to detect when ssl is established, because s_client
2069 ;; doesn't give any CONNECTIONESTABLISHED kind of message, and
2070 ;; most IRC servers send nothing and wait for you to identify.
2071 (sit-for 5)
2072 proc)))
2073
2074;;; Debugging the protocol
2075
2076(defvar erc-debug-irc-protocol nil
2077 "If non-nil, log all IRC protocol traffic to the buffer \"*erc-protocol*\".
2078
2079The buffer is created if it doesn't exist.
2080
2081NOTE: If this variable is non-nil, and you kill the the only
2082visible \"*erc-protocol*\" buffer, it will be recreated shortly,
2083but you won't see it.
2084
2085WARNING: Do not set this variable directly! Instead, use the
2086function `erc-toggle-debug-irc-protocol' to toggle its value.")
2087
2088(defun erc-log-irc-protocol (string &optional outbound)
2089 "Append STRING to the buffer *erc-protocol*.
2090
2091This only has any effect if `erc-debug-irc-protocol' is non-nil.
2092
2093The buffer is created if it doesn't exist.
2094
2095If OUTBOUND is non-nil, STRING is being sent to the IRC server
2096and appears in erc-input-face in the buffer."
2097 (when erc-debug-irc-protocol
2098 (let ((network-name (or (ignore-errors (erc-network-name))
2099 "???")))
2100 (with-current-buffer (get-buffer-create "*erc-protocol*")
2101 (save-excursion
2102 (goto-char (point-max))
2103 (let ((inhibit-read-only t))
2104 (insert (if (not outbound)
2105 ;; Cope with the fact that string might
2106 ;; contain multiple lines of text.
2107 (let ((lines (delete "" (split-string string
2108 "\n\\|\r\n")))
2109 (result ""))
2110 (dolist (line lines)
2111 (setq result (concat result network-name
2112 " << " line "\n")))
2113 result)
2114 (erc-propertize
2115 (concat network-name " >> " string
2116 (if (/= ?\n
2117 (aref string
2118 (1- (length string))))
2119 "\n"))
2120 'face 'erc-input-face)))))
2121 (let ((orig-win (selected-window))
2122 (debug-buffer-window (get-buffer-window (current-buffer) t)))
2123 (when debug-buffer-window
2124 (select-window debug-buffer-window)
2125 (when (= 1 (count-lines (point) (point-max)))
2126 (goto-char (point-max))
2127 (recenter -1))
2128 (select-window orig-win)))))))
2129
2130(defun erc-toggle-debug-irc-protocol (&optional arg)
2131 "Toggle the value of `erc-debug-irc-protocol'.
2132
2133If ARG is non-nil, show the *erc-protocol* buffer."
2134 (interactive "P")
2135 (let* ((buf (get-buffer-create "*erc-protocol*")))
2136 (with-current-buffer buf
2137 (erc-view-mode-enter 1)
2138 (when (null (current-local-map))
2139 (let ((inhibit-read-only t))
2140 (insert (erc-make-notice "This buffer displays all IRC protocol traffic exchanged with each server.\n"))
2141 (insert (erc-make-notice "Kill this buffer to terminate protocol logging.\n\n")))
2142 (use-local-map (make-sparse-keymap))
2143 (local-set-key (kbd "RET") 'erc-toggle-debug-irc-protocol))
2144 (add-hook 'kill-buffer-hook
2145 #'(lambda () (setq erc-debug-irc-protocol nil))
2146 nil 'local)
2147 (goto-char (point-max))
2148 (let ((inhibit-read-only t))
2149 (insert (erc-make-notice
2150 (format "IRC protocol logging %s at %s -- Press ENTER to toggle logging.\n"
2151 (if erc-debug-irc-protocol "disabled" "enabled")
2152 (current-time-string))))))
2153 (setq erc-debug-irc-protocol (not erc-debug-irc-protocol))
2154 (if (and arg
2155 (not (get-buffer-window "*erc-protocol*" t)))
2156 (display-buffer buf t))
2157 (message "IRC protocol traffic logging %s (see buffer *erc-protocol*)."
2158 (if erc-debug-irc-protocol "enabled" "disabled"))))
2159
2160;;; I/O interface
2161
2162;; send interface
2163
2164(defun erc-send-action (tgt str &optional force)
2165 "Send CTCP ACTION information described by STR to TGT."
2166 (erc-send-ctcp-message tgt (format "ACTION %s" str) force)
2167 (erc-display-message
2168 nil 'input (current-buffer)
2169 'ACTION ?n (erc-current-nick) ?a str ?u "" ?h ""))
2170
2171;; Display interface
2172
2173(defun erc-string-invisible-p (string)
2174 "Check whether STRING is invisible or not.
2175I.e. any char in it has the `invisible' property set."
2176 (text-property-any 0 (length string) 'invisible t string))
2177
2178(defun erc-display-line-1 (string buffer)
2179 "Display STRING in `erc-mode' BUFFER.
2180Auxiliary function used in `erc-display-line'. The line gets filtered to
2181interpret the control characters. Then, `erc-insert-pre-hook' gets called.
2182If `erc-insert-this' is still t, STRING gets inserted into the buffer.
2183Afterwards, `erc-insert-modify' and `erc-insert-post-hook' get called.
2184If STRING is nil, the function does nothing."
2185 (when string
2186 (save-excursion
2187 (set-buffer (or buffer (process-buffer erc-server-process)))
2188 (let ((insert-position (or (marker-position erc-insert-marker)
2189 (point-max))))
2190 (let ((string string) ;; FIXME! Can this be removed?
2191 (buffer-undo-list t)
2192 (inhibit-read-only t))
2193 (unless (string-match "\n$" string)
2194 (setq string (concat string "\n"))
2195 (when (erc-string-invisible-p string)
2196 (erc-put-text-properties 0 (length string) string
2197 '(invisible intangible))))
2198 (erc-log (concat "erc-display-line: " string
2199 (format "(%S)" string) " in buffer "
2200 (format "%s" buffer)))
2201 (setq erc-insert-this t)
2202 (run-hook-with-args 'erc-insert-pre-hook string)
2203 (if (null erc-insert-this)
2204 ;; Leave erc-insert-this set to t as much as possible. Fran
2205 ;; Litterio <franl> has seen erc-insert-this set to nil while
2206 ;; erc-send-pre-hook is running, which should never happen. This
2207 ;; may cure it.
2208 (setq erc-insert-this t)
2209 (save-excursion ;; to restore point in the new buffer
2210 (save-restriction
2211 (widen)
2212 (goto-char insert-position)
2213 (insert-before-markers string)
2214 ;; run insertion hook, with point at restored location
2215 (save-restriction
2216 (narrow-to-region insert-position (point))
2217 (run-hooks 'erc-insert-modify-hook)
2218 (run-hooks 'erc-insert-post-hook))))))
2219 (erc-update-undo-list (- (or (marker-position erc-insert-marker)
2220 (point-max))
2221 insert-position))))))
2222
2223(defun erc-update-undo-list (shift)
2224 ;; Translate buffer positions in buffer-undo-list by SHIFT.
2225 (unless (or (zerop shift) (atom buffer-undo-list))
2226 (let ((list buffer-undo-list) elt)
2227 (while list
2228 (setq elt (car list))
2229 (cond ((integerp elt) ; POSITION
2230 (incf (car list) shift))
2231 ((or (atom elt) ; nil, EXTENT
2232 ;; (eq t (car elt)) ; (t HIGH . LOW)
2233 (markerp (car elt))) ; (MARKER . DISTANCE)
2234 nil)
2235 ((integerp (car elt)) ; (BEGIN . END)
2236 (incf (car elt) shift)
2237 (incf (cdr elt) shift))
2238 ((stringp (car elt)) ; (TEXT . POSITION)
2239 (incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift)))
2240 ((null (car elt)) ; (nil PROPERTY VALUE BEG . END)
2241 (let ((cons (nthcdr 3 elt)))
2242 (incf (car cons) shift)
2243 (incf (cdr cons) shift)))
2244 ((and (featurep 'xemacs)
2245 (extentp (car elt))) ; (EXTENT START END)
2246 (incf (nth 1 elt) shift)
2247 (incf (nth 2 elt) shift)))
2248 (setq list (cdr list))))))
2249
2250(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
2251 "Regexp which matches all legal characters in a IRC nickname.")
2252
2253(defun erc-is-valid-nick-p (nick)
2254 "Check if NICK is a valid IRC nickname."
2255 (string-match (concat "^" erc-valid-nick-regexp "$") nick))
2256
2257(defun erc-display-line (string &optional buffer)
2258 "Display STRING in the ERC BUFFER.
2259All screen output must be done through this function. If BUFFER is nil
2260or omitted, the default ERC buffer for the `erc-session-server' is used.
2261The BUFFER can be an actual buffer, a list of buffers, 'all or 'active.
2262If BUFFER = 'all, the string is displayed in all the ERC buffers for the
2263current session. 'active means the current active buffer
2264\(`erc-active-buffer'). If the buffer can't be resolved, the current
2265buffer is used. `erc-display-line-1' is used to display STRING.
2266
2267If STRING is nil, the function does nothing."
2268 (let ((inhibit-point-motion-hooks t)
2269 new-bufs)
2270 (dolist (buf (cond
2271 ((bufferp buffer) (list buffer))
2272 ((listp buffer) buffer)
2273 ((processp buffer) (list (process-buffer buffer)))
2274 ((eq 'all buffer)
2275 (and (boundp 'erc-server-process)
2276 ;; Hmm, or all of the same session server?
2277 (erc-buffer-list nil erc-server-process)))
2278 ((and (eq 'active buffer) (erc-active-buffer))
2279 (list (erc-active-buffer)))
2280 ((erc-server-buffer-live-p)
2281 (list (process-buffer erc-server-process)))
2282 (t (list (current-buffer)))))
2283 (when (buffer-live-p buf)
2284 (erc-display-line-1 string buf)
2285 (add-to-list 'new-bufs buf)))
2286 (when (null new-bufs)
2287 (if (erc-server-buffer-live-p)
2288 (erc-display-line-1 string (process-buffer erc-server-process))
2289 (erc-display-line-1 string (current-buffer))))))
2290
2291(defun erc-display-message-highlight (type string)
2292 "Highlight STRING according to TYPE, where erc-TYPE-face is an erc face.
2293
2294See also `erc-make-notice'"
2295 (cond ((eq type 'notice)
2296 (erc-make-notice string))
2297 (t
2298 (erc-put-text-property
2299 0 (length string)
2300 'face (or (intern-soft
2301 (concat "erc-" (symbol-name type) "-face"))
2302 "erc-default-face")
2303 string)
2304 string)))
2305
2306(defun erc-display-message (parsed type buffer msg &rest args)
2307 "Display MSG in BUFFER.
2308
2309ARGS, PARSED, and TYPE are used to format MSG sensibly.
2310
2311See also `erc-format-message' and `erc-display-line'."
2312 (let ((string (if (symbolp msg)
2313 (apply 'erc-format-message msg args)
2314 msg)))
2315 (setq string
2316 (cond
2317 ((listp type)
2318 (mapc (lambda (type)
2319 (setq string
2320 (erc-display-message-highlight type string)))
2321 type)
2322 string)
2323 ((symbolp type)
2324 (erc-display-message-highlight type string))))
2325
2326 (if (not (erc-response-p parsed))
2327 (erc-display-line string buffer)
2328 (unless (member (erc-response.command parsed) erc-hide-list)
2329 (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
2330 (erc-put-text-property 0 (length string) 'rear-sticky t string)
2331 (erc-display-line string buffer)))))
2332
2333(defun erc-message-type-member (position list)
2334 "Return non-nil if the erc-parsed text-property at POSITION is in LIST.
2335
2336This function relies on the erc-parsed text-property being
2337present."
2338 (let ((prop-val (get-text-property position 'erc-parsed)))
2339 (and prop-val (member (erc-response.command prop-val) list))))
2340
2341(defvar erc-send-input-line-function 'erc-send-input-line)
2342(make-variable-buffer-local 'erc-send-input-line-function)
2343
2344(defun erc-send-input-line (target line &optional force)
2345 "Send LINE to TARGET.
2346
2347See also `erc-server-send'."
2348 (setq line (format "PRIVMSG %s :%s"
2349 target
2350 ;; If the line is empty, we still want to
2351 ;; send it - i.e. an empty pasted line.
2352 (if (string= line "\n")
2353 " \n"
2354 line)))
2355 (erc-server-send line force target))
2356
2357(defun erc-get-arglist (fun)
2358 "Return the argument list of a function without the parens."
2359 (let ((arglist (format "%S" (erc-function-arglist fun))))
2360 (if (string-match "^(\\(.*\\))$" arglist)
2361 (match-string 1 arglist)
2362 arglist)))
2363
2364(defun erc-command-name (cmd)
2365 "For CMD being the function name of a ERC command, something like
2366erc-cmd-FOO, this returns a string /FOO."
2367 (let ((command-name (symbol-name cmd)))
2368 (if (string-match "^erc-cmd-\\(.*\\)$" command-name)
2369 (concat "/" (match-string 1 command-name))
2370 command-name)))
2371
2372(defun erc-process-input-line (line &optional force no-command)
2373 "Translate LINE to an RFC1459 command and send it based.
2374Returns non-nil if the command is actually sent to the server, and nil
2375otherwise.
2376
2377If the command in the LINE is not bound as a function `erc-cmd-<COMMAND>',
2378it is passed to `erc-cmd-default'. If LINE is not a command (ie. doesn't
2379start with /<COMMAND>) then it is sent as a message.
2380
2381An optional FORCE argument forces sending the line when flood
2382protection is in effect. The optional NO-COMMAND argument prohibits
2383this function from interpreting the line as a command."
2384 (let ((command-list (erc-extract-command-from-line line)))
2385 (if (and command-list
2386 (not no-command))
2387 (let* ((cmd (nth 0 command-list))
2388 (args (nth 1 command-list)))
2389 (condition-case nil
2390 (if (listp args)
2391 (apply cmd args)
2392 (funcall cmd args))
2393 (wrong-number-of-arguments
2394 (erc-display-message nil 'error (current-buffer) 'incorrect-args
2395 ?c (erc-command-name cmd)
2396 ?u (or (erc-get-arglist cmd)
2397 "")
2398 ?d (format "%s\n"
2399 (or (documentation cmd) "")))
2400 nil)))
2401 (let ((r (erc-default-target)))
2402 (if r
2403 (funcall erc-send-input-line-function r line force)
2404 (erc-display-message nil 'error (current-buffer) 'no-target)
2405 nil)))))
2406
2407;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2408;; Input commands handlers
2409;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2410
2411(defun erc-cmd-AMSG (line)
2412 "Send LINE to all channels of the current server that you are on."
2413 (interactive "sSend to all channels you're on: ")
2414 (setq line (erc-trim-string line))
2415 (erc-with-all-buffers-of-server nil
2416 (lambda ()
2417 (erc-channel-p (erc-default-target)))
2418 (erc-send-message line)))
2419(put 'erc-cmd-AMSG 'do-not-parse-args t)
2420
2421(defun erc-cmd-SAY (line)
2422 "Send LINE to the current query or channel as a message, not a command.
2423
2424Use this when you want to send a message with a leading '/'. Note
2425that since multi-line messages are never a command, you don't
2426need this when pasting multiple lines of text."
2427 (if (string-match "^\\s-*$" line)
2428 nil
2429 (string-match "^ ?\\(.*\\)" line)
2430 (erc-process-input-line (match-string 1 line) nil t)))
2431(put 'erc-cmd-SAY 'do-not-parse-args t)
2432
2433(defun erc-cmd-SET (line)
2434 "Set the variable named by the first word in LINE to some VALUE.
2435VALUE is computed by evaluating the rest of LINE in Lisp."
2436 (cond
2437 ((string-match "^\\s-*\\(\\S-+\\)\\s-+\\(.*\\)$" line)
2438 (let ((var (read (concat "erc-" (match-string 1 line))))
2439 (val (read (match-string 2 line))))
2440 (if (boundp var)
2441 (progn
2442 (set var (eval val))
2443 (erc-display-message
2444 nil nil 'active (format "Set %S to %S" var val))
2445 t)
2446 (setq var (read (match-string 1 line)))
2447 (if (boundp var)
2448 (progn
2449 (set var (eval val))
2450 (erc-display-message
2451 nil nil 'active (format "Set %S to %S" var val))
2452 t)
2453 (erc-display-message nil 'error 'active 'variable-not-bound)
2454 nil))))
2455 ((string-match "^\\s-*$" line)
2456 (erc-display-line
2457 (concat "Available user variables:\n"
2458 (apply
2459 'concat
2460 (mapcar
2461 (lambda (var)
2462 (let ((val (symbol-value var)))
2463 (concat (format "%S:" var)
2464 (if (consp val)
2465 (concat "\n" (pp-to-string val))
2466 (format " %S\n" val)))))
2467 (apropos-internal "^erc-" 'user-variable-p))))
2468 (current-buffer)) t)
2469 (t nil)))
2470(defalias 'erc-cmd-VAR 'erc-cmd-SET)
2471(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET)
2472(put 'erc-cmd-SET 'do-not-parse-args t)
2473
2474(defun erc-cmd-default (line)
2475 "Fallback command.
2476
2477Commands for which no erc-cmd-xxx exists, are tunnelled through
2478this function. LINE is sent to the server verbatim, and
2479therefore has to contain the command itself as well."
2480 (erc-log (format "cmd: DEFAULT: %s" line))
2481 (erc-server-send (substring line 1))
2482 t)
2483
2484(defun erc-cmd-IGNORE (&optional user)
2485 "Ignore USER. This should be a regexp matching nick!user@host.
2486If no USER argument is specified, list the contents of `erc-ignore-list'."
2487 (if user
2488 (progn
2489 (erc-display-line
2490 (erc-make-notice (format "Now ignoring %s" user))
2491 'active)
2492 (with-current-buffer (erc-server-buffer)
2493 (add-to-list 'erc-ignore-list user)))
2494 (if (null (with-current-buffer (erc-server-buffer) erc-ignore-list))
2495 (erc-display-line (erc-make-notice "Ignore list is empty") 'active)
2496 (erc-display-line (erc-make-notice "Ignore list:") 'active)
2497 (mapc #'(lambda (item)
2498 (erc-display-line (erc-make-notice item)
2499 'active))
2500 (with-current-buffer (erc-server-buffer) erc-ignore-list))))
2501 t)
2502
2503(defun erc-cmd-UNIGNORE (user)
2504 "Remove the user specified in USER from the ignore list."
2505 (let ((ignored-nick (car (with-current-buffer (erc-server-buffer)
2506 (erc-member-ignore-case user erc-ignore-list)))))
2507 (if (null ignored-nick)
2508 (erc-display-line
2509 (erc-make-notice (format "%s is not currently ignored!" user))
2510 'active)
2511 (erc-display-line
2512 (erc-make-notice (format "No longer ignoring %s" user))
2513 'active))
2514 (with-current-buffer (erc-server-buffer)
2515 (setq erc-ignore-list (delete ignored-nick erc-ignore-list))))
2516 t)
2517
2518(defun erc-cmd-CLEAR ()
2519 "Clear the window content."
2520 (recenter 0)
2521 t)
2522
2523(defun erc-cmd-OPS ()
2524 "Show the ops in the current channel."
2525 (interactive)
2526 (let ((ops nil))
2527 (if erc-channel-users
2528 (maphash (lambda (nick user-data)
2529 (let ((cuser (cdr user-data)))
2530 (if (and cuser
2531 (erc-channel-user-op cuser))
2532 (setq ops (cons (erc-server-user-nickname
2533 (car user-data))
2534 ops)))))
2535 erc-channel-users))
2536 (setq ops (sort ops 'string-lessp))
2537 (if ops
2538 (erc-display-message
2539 nil 'notice (current-buffer) 'ops
2540 ?i (length ops) ?s (if (> (length ops) 1) "s" "")
2541 ?o (mapconcat 'identity ops " "))
2542 (erc-display-message nil 'notice (current-buffer) 'ops-none)))
2543 t)
2544
2545(defun erc-cmd-COUNTRY (tld)
2546 "Display the country associated with the top level domain TLD."
2547 (require 'mail-extr)
2548 (let ((co (ignore-errors (what-domain tld))))
2549 (if co
2550 (erc-display-message
2551 nil 'notice 'active 'country ?c co ?d tld)
2552 (erc-display-message
2553 nil 'notice 'active 'country-unknown ?d tld))
2554 t))
2555
2556(defun erc-cmd-AWAY (line)
2557 "Mark the user as being away, the reason being indicated by LINE.
2558If no reason is given, unset away status."
2559 (when (string-match "^\\s-*\\(.*\\)$" line)
2560 (let ((reason (match-string 1 line)))
2561 (erc-log (format "cmd: AWAY: %s" reason))
2562 (erc-server-send
2563 (if (string= reason "")
2564 "AWAY"
2565 (concat "AWAY :" reason))))
2566 t))
2567(put 'erc-cmd-AWAY 'do-not-parse-args t)
2568
2569(defun erc-cmd-GAWAY (line)
2570 "Mark the user as being away everywhere, the reason being indicated by LINE."
2571 ;; on all server buffers.
2572 (erc-with-all-buffers-of-server nil
2573 #'erc-server-buffer-p
2574 (erc-cmd-AWAY line)))
2575(put 'erc-cmd-GAWAY 'do-not-parse-args t)
2576
2577(defun erc-cmd-CTCP (nick cmd &rest args)
2578 "Send a Client To Client Protocol message to NICK.
2579
2580CMD is the CTCP command, possible values being ECHO, FINGER, CLIENTINFO, TIME,
2581VERSION and so on. It is called with ARGS."
2582 (let ((str (concat cmd
2583 (when args
2584 (concat " " (mapconcat #'identity args " "))))))
2585 (erc-log (format "cmd: CTCP [%s]: [%s]" nick str))
2586 (erc-send-ctcp-message nick str)
2587 t))
2588
2589(defun erc-cmd-HELP (&optional func)
2590 "Popup help information.
2591
2592If FUNC contains a valid function or variable, help about that
2593will be displayed. If FUNC is empty, display an apropos about
2594erc commands. Otherwise, do apropos in the erc namespace
2595\(\"erc-.*LINE\"\).
2596
2597Examples:
2598To find out about erc and bbdb, do
2599 /help bbdb.*
2600
2601For help about the WHOIS command, do:
2602 /help whois
2603
2604For a list of user commands (/join /part, ...):
2605 /help."
2606 (if func
2607 (let* ((sym (or (let ((sym (intern-soft
2608 (concat "erc-cmd-" (upcase func)))))
2609 (if (and sym (or (boundp sym) (fboundp sym)))
2610 sym
2611 nil))
2612 (let ((sym (intern-soft func)))
2613 (if (and sym (or (boundp sym) (fboundp sym)))
2614 sym
2615 nil))
2616 (let ((sym (intern-soft (concat "erc-" func))))
2617 (if (and sym (or (boundp sym) (fboundp sym)))
2618 sym
2619 nil)))))
2620 (if sym
2621 (cond
2622 ((boundp sym) (describe-variable sym))
2623 ((fboundp sym) (describe-function sym))
2624 (t nil))
2625 (apropos-command (concat "erc-.*" func) nil
2626 (lambda (x)
2627 (or (commandp x)
2628 (get x 'custom-type))))
2629 t))
2630 (apropos "erc-cmd-")
2631 (message "Type C-h m to get additional information about keybindings.")
2632 t))
2633
2634(defalias 'erc-cmd-H 'erc-cmd-HELP)
2635
2636(defun erc-cmd-JOIN (channel &optional key)
2637 "Join the channel given in CHANNEL, optionally with KEY.
2638If CHANNEL is specified as \"-invite\", join the channel to which you
2639were most recently invited. See also `invitation'."
2640 (let (chnl)
2641 (if (string= (upcase channel) "-INVITE")
2642 (if erc-invitation
2643 (setq chnl erc-invitation)
2644 (erc-display-message nil 'error (current-buffer) 'no-invitation))
2645 (setq chnl (erc-ensure-channel-name channel)))
2646 (when chnl
2647 ;; Prevent double joining of same channel on same server.
2648 (let ((joined-channels
2649 (mapcar #'(lambda (chanbuf)
2650 (with-current-buffer chanbuf (erc-default-target)))
2651 (erc-channel-list erc-server-process))))
2652 (if (erc-member-ignore-case chnl joined-channels)
2653 (switch-to-buffer (car (erc-member-ignore-case chnl
2654 joined-channels)))
2655 (erc-log (format "cmd: JOIN: %s" chnl))
2656 (if (and chnl key)
2657 (erc-server-send (format "JOIN %s %s" chnl key))
2658 (erc-server-send (format "JOIN %s" chnl)))))))
2659 t)
2660
2661(defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN)
2662(defalias 'erc-cmd-J 'erc-cmd-JOIN)
2663
2664(defvar erc-channel-new-member-names nil
2665 "If non-nil, a names list is currently being received.
2666
2667If non-nil, this variable is a hash-table that associates
2668received nicks with t.")
2669(make-variable-buffer-local 'erc-channel-new-member-names)
2670
2671(defun erc-cmd-NAMES (&optional channel)
2672 "Display the users in CHANNEL.
2673If CHANNEL is not specified, display the users in the current channel.
2674This function clears the channel name list first, then sends the
2675command."
2676 (let ((tgt (or (and (erc-channel-p channel) channel)
2677 (erc-default-target))))
2678 (if (and tgt (erc-channel-p tgt))
2679 (progn
2680 (erc-log (format "cmd: DEFAULT: NAMES %s" tgt))
2681 (erc-with-buffer
2682 (tgt)
2683 (erc-channel-begin-receiving-names))
2684 (erc-server-send (concat "NAMES " tgt)))
2685 (erc-display-message nil 'error (current-buffer) 'no-default-channel)))
2686 t)
2687(defalias 'erc-cmd-N 'erc-cmd-NAMES)
2688
2689(defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords)
2690 "Kick the user indicated in LINE from the current channel.
2691LINE has the format: \"#CHANNEL NICK REASON\" or \"NICK REASON\"."
2692 (let ((reasonstring (mapconcat 'identity reasonwords " ")))
2693 (if (string= "" reasonstring)
2694 (setq reasonstring (format "Kicked by %s" (erc-current-nick))))
2695 (if (erc-channel-p target)
2696 (let ((nick reason-or-nick))
2697 (erc-log (format "cmd: KICK: %s/%s: %s" nick target reasonstring))
2698 (erc-server-send (format "KICK %s %s :%s" target nick reasonstring)
2699 nil target)
2700 t)
2701 (when target
2702 (let ((ch (erc-default-target)))
2703 (setq reasonstring (concat
2704 (if reason-or-nick (concat reason-or-nick " "))
2705 reasonstring))
2706 (if ch
2707 (progn
2708 (erc-log
2709 (format "cmd: KICK: %s/%s: %s" target ch reasonstring))
2710 (erc-server-send
2711 (format "KICK %s %s :%s" ch target reasonstring) nil ch))
2712 (erc-display-message nil 'error (current-buffer)
2713 'no-default-channel))
2714 t)))))
2715
2716(defvar erc-script-args nil)
2717
2718(defun erc-cmd-LOAD (line)
2719 "Load the script provided in the LINE.
2720If LINE continues beyond the file name,
2721the rest of it is put in a (local) variable
2722`erc-script-args', which can be used in elisp scripts.
2723
2724The optional FORCE argument is ignored here - you can't force loading
2725a script after exceeding the flood threshold."
2726 (cond
2727 ((string-match "^\\s-*\\(\\S-+\\)\\(.*\\)$" line)
2728 (let* ((file-to-find (match-string 1 line))
2729 (erc-script-args (match-string 2 line))
2730 (file (erc-find-file file-to-find erc-script-path)))
2731 (erc-log (format "cmd: LOAD: %s" file-to-find))
2732 (cond
2733 ((not file)
2734 (erc-display-message nil 'error (current-buffer)
2735 'cannot-find-file ?f file-to-find))
2736 ((not (file-readable-p file))
2737 (erc-display-message nil 'error (current-buffer)
2738 'cannot-read-file ?f file))
2739 (t
2740 (message "Loading \'%s\'..." file)
2741 (erc-load-script file)
2742 (message "Loading \'%s\'...done" file))))
2743 t)
2744 (t nil)))
2745
2746(defun erc-cmd-WHOIS (user &optional server)
2747 "Display whois information for USER.
2748
2749If SERVER is non-nil, use that, rather than the current server."
2750 ;; FIXME: is the above docstring correct? -- Lawrence 2004-01-08
2751 (let ((send (if server
2752 (format "WHOIS %s %s" user server)
2753 (format "WHOIS %s" user))))
2754 (erc-log (format "cmd: %s" send))
2755 (erc-server-send send)
2756 t))
2757(defalias 'erc-cmd-WI 'erc-cmd-WHOIS)
2758
2759(defun erc-cmd-WHOAMI ()
2760 "Display whois information about yourself."
2761 (erc-cmd-WHOIS (erc-current-nick))
2762 t)
2763
2764(defun erc-cmd-IDLE (nick)
2765 "Show the length of time NICK has been idle."
2766 (let ((serverbuf (erc-server-buffer))
2767 (origbuf (current-buffer))
2768 symlist)
2769 (with-current-buffer serverbuf
2770 (add-to-list 'symlist
2771 (cons (erc-once-with-server-event
2772 311 `(string= ,nick
2773 (second
2774 (erc-response.command-args parsed))))
2775 'erc-server-311-functions))
2776 (add-to-list 'symlist
2777 (cons (erc-once-with-server-event
2778 312 `(string= ,nick
2779 (second
2780 (erc-response.command-args parsed))))
2781 'erc-server-312-functions))
2782 (add-to-list 'symlist
2783 (cons (erc-once-with-server-event
2784 318 `(string= ,nick
2785 (second
2786 (erc-response.command-args parsed))))
2787 'erc-server-318-functions))
2788 (add-to-list 'symlist
2789 (cons (erc-once-with-server-event
2790 319 `(string= ,nick
2791 (second
2792 (erc-response.command-args parsed))))
2793 'erc-server-319-functions))
2794 (add-to-list 'symlist
2795 (cons (erc-once-with-server-event
2796 320 `(string= ,nick
2797 (second
2798 (erc-response.command-args parsed))))
2799 'erc-server-320-functions))
2800 (add-to-list 'symlist
2801 (cons (erc-once-with-server-event
2802 330 `(string= ,nick
2803 (second
2804 (erc-response.command-args parsed))))
2805 'erc-server-330-functions))
2806 (add-to-list 'symlist
2807 (cons (erc-once-with-server-event
2808 317
2809 `(let ((idleseconds
2810 (string-to-number
2811 (third
2812 (erc-response.command-args parsed)))))
2813 (erc-display-line
2814 (erc-make-notice
2815 (format "%s has been idle for %s."
2816 (erc-string-no-properties ,nick)
2817 (erc-seconds-to-string idleseconds)))
2818 ,origbuf))
2819 t)
2820 'erc-server-317-functions))
2821
2822 ;; Send the WHOIS command.
2823 (erc-cmd-WHOIS nick)
2824
2825 ;; Remove the uninterned symbols from the server hooks that did not run.
2826 (run-at-time 20 nil `(lambda ()
2827 (with-current-buffer ,(current-buffer)
2828 (dolist (sym ',symlist)
2829 (let ((hooksym (cdr sym))
2830 (funcsym (car sym)))
2831 (remove-hook hooksym funcsym t))))))))
2832 t)
2833
2834(defun erc-cmd-DESCRIBE (line)
2835 "Pose some action to a certain user.
2836LINE has the format \"USER ACTION\"."
2837 (cond
2838 ((string-match
2839 "^\\s-*\\(\\S-+\\)\\s-\\(.*\\)$" line)
2840 (let ((dst (match-string 1 line))
2841 (s (match-string 2 line)))
2842 (erc-log (format "cmd: DESCRIBE: [%s] %s" dst s))
2843 (erc-send-action dst s))
2844 t)
2845 (t nil)))
2846(put 'erc-cmd-DESCRIBE 'do-not-parse-args t)
2847
2848(defun erc-cmd-ME (line)
2849 "Send LINE as an action."
2850 (cond
2851 ((string-match "^\\s-\\(.*\\)$" line)
2852 (let ((s (match-string 1 line)))
2853 (erc-log (format "cmd: ME: %s" s))
2854 (erc-send-action (erc-default-target) s))
2855 t)
2856 (t nil)))
2857(put 'erc-cmd-ME 'do-not-parse-args t)
2858
2859(defun erc-cmd-LASTLOG (line)
2860 "Show all lines in the current buffer matching the regexp LINE.
2861
2862If a match spreads across multiple lines, all those lines are shown.
2863
2864The lines are shown in a buffer named `*Occur*'.
2865It serves as a menu to find any of the occurrences in this buffer.
2866\\[describe-mode] in that buffer will explain how.
2867
2868If LINE contains upper case characters (excluding those preceded by `\'),
2869the matching is case-sensitive."
2870 (occur line)
2871 t)
2872(put 'erc-cmd-LASTLOG 'do-not-parse-args t)
2873
2874(defun erc-send-message (line &optional force)
2875 "Send LINE to the current channel or user and display it.
2876
2877See also `erc-message' and `erc-display-line'."
2878 (erc-message "PRIVMSG" (concat (erc-default-target) " " line) force)
2879 (erc-display-line
2880 (concat (erc-format-my-nick) line)
2881 (current-buffer))
2882 ;; FIXME - treat multiline, run hooks, or remove me?
2883 t)
2884
2885(defun erc-cmd-MODE (line)
2886 "Change or display the mode value of a channel or user.
2887The first word specifies the target. The rest is the mode string
2888to send.
2889
2890If only one word is given, display the mode of that target.
2891
2892A list of valid mode strings for Freenode may be found at
2893`http://freenode.net/using_the_network.shtml'."
2894 (cond
2895 ((string-match "^\\s-\\(.*\\)$" line)
2896 (let ((s (match-string 1 line)))
2897 (erc-log (format "cmd: MODE: %s" s))
2898 (erc-server-send (concat "MODE " line)))
2899 t)
2900 (t nil)))
2901(put 'erc-cmd-MODE 'do-not-parse-args t)
2902
2903(defun erc-cmd-NOTICE (channel-or-user &rest message)
2904 "Send a notice to the channel or user given as the first word.
2905The rest is the message to send."
2906 (erc-message "NOTICE" (concat channel-or-user " "
2907 (mapconcat #'identity message " "))))
2908
2909(defun erc-cmd-MSG (line)
2910 "Send a message to the channel or user given as the first word in LINE.
2911
2912The rest of LINE is the message to send."
2913 (erc-message "PRIVMSG" line))
2914
2915(defalias 'erc-cmd-M 'erc-cmd-MSG)
2916(put 'erc-cmd-MSG 'do-not-parse-args t)
2917
2918(defun erc-cmd-SQUERY (line)
2919 "Send a Service Query to the service given as the first word in LINE.
2920
2921The rest of LINE is the message to send."
2922 (erc-message "SQUERY" line))
2923
2924(defun erc-cmd-NICK (nick)
2925 "Change current nickname to NICK."
2926 (erc-log (format "cmd: NICK: %s (erc-bad-nick: %S)" nick erc-bad-nick))
2927 (let ((nicklen (cdr (assoc "NICKLEN" (with-current-buffer (erc-server-buffer)
2928 erc-server-parameters)))))
2929 (and nicklen (> (length nick) (string-to-number nicklen))
2930 (erc-display-message
2931 nil 'notice 'active 'nick-too-long
2932 ?i (length nick) ?l nicklen)))
2933 (erc-server-send (format "NICK %s" nick))
2934 (cond (erc-bad-nick
2935 (erc-set-current-nick nick)
2936 (erc-update-mode-line)
2937 (setq erc-bad-nick nil)))
2938 t)
2939
2940(defun erc-cmd-PART (line)
2941 "When LINE is an empty string, leave the current channel.
2942Otherwise leave the channel indicated by LINE."
2943 (cond
2944 ((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-?\\(.*\\)$" line)
2945 (let* ((ch (match-string 1 line))
2946 (msg (match-string 2 line))
2947 (reason (funcall erc-part-reason (if (equal msg "") nil msg))))
2948 (erc-log (format "cmd: PART: %s: %s" ch reason))
2949 (erc-server-send (if (string= reason "")
2950 (format "PART %s" ch)
2951 (format "PART %s :%s" ch reason))
2952 nil ch))
2953 t)
2954 ((string-match "^\\s-*\\(.*\\)$" line)
2955 (let* ((ch (erc-default-target))
2956 (msg (match-string 1 line))
2957 (reason (funcall erc-part-reason (if (equal msg "") nil msg))))
2958 (if (and ch (erc-channel-p ch))
2959 (progn
2960 (erc-log (format "cmd: PART: %s: %s" ch reason))
2961 (erc-server-send (if (string= reason "")
2962 (format "PART %s" ch)
2963 (format "PART %s :%s" ch reason))
2964 nil ch))
2965 (erc-display-message nil 'error (current-buffer) 'no-target)))
2966 t)
2967 (t nil)))
2968(put 'erc-cmd-PART 'do-not-parse-args t)
2969
2970(defalias 'erc-cmd-LEAVE 'erc-cmd-PART)
2971
2972(defun erc-cmd-PING (recipient)
2973 "Ping RECIPIENT."
2974 (let ((time (format "%f" (erc-current-time))))
2975 (erc-log (format "cmd: PING: %s" time))
2976 (erc-cmd-CTCP recipient "PING" time)))
2977
2978(defun erc-cmd-QUOTE (line)
2979 "Send LINE directly to the server.
2980All the text given as argument is sent to the sever as unmodified,
2981just as you provided it. Use this command with care!"
2982 (cond
2983 ((string-match "^\\s-\\(.+\\)$" line)
2984 (erc-server-send (match-string 1 line)))
2985 (t nil)))
2986(put 'erc-cmd-QUOTE 'do-not-parse-args t)
2987
2988(defun erc-cmd-QUERY (&optional user)
2989 "Open a query with USER.
2990The type of query window/frame/etc will depend on the value of
2991`erc-join-buffer'. If USER is omitted, close the current query buffer if one
2992exists - except this is broken now ;-)"
2993 (interactive
2994 (list (read-from-minibuffer "Start a query with: " nil)))
2995 (let ((session-buffer (erc-server-buffer)))
2996 (if user
2997 (erc-query user session-buffer)
2998 ;; currently broken, evil hack to display help anyway
2999 ;(erc-delete-query))))
3000 (signal 'wrong-number-of-arguments ""))))
3001(defalias 'erc-cmd-Q 'erc-cmd-QUERY)
3002
3003(defun erc-quit-reason-normal (&optional s)
3004 "Normal quit message.
3005
3006If S is non-nil, it will be used as the quit reason."
3007 (or s
3008 (format "\C-bERC\C-b %s (IRC client for Emacs)"; - \C-b%s\C-b"
3009 erc-version-string) ; erc-official-location)
3010 ))
3011
3012(defun erc-quit-reason-zippy (&optional s)
3013 "Zippy quit message.
3014
3015If S is non-nil, it will be used as the quit reason."
3016 (or s
3017 (erc-replace-regexp-in-string "\n" "" (yow))))
3018
3019(defun erc-quit-reason-various (s)
3020 "Choose a quit reason based on S (a string)."
3021 (when (featurep 'xemacs) (require 'poe))
3022 (let ((res (car (assoc-default (or s "")
3023 erc-quit-reason-various-alist 'string-match))))
3024 (cond
3025 ((functionp res) (funcall res))
3026 ((stringp res) res)
3027 ;; hopefully never reached
3028 (s))))
3029
3030(defun erc-part-reason-normal (&optional s)
3031 "Normal part message.
3032
3033If S is non-nil, it will be used as the quit reason."
3034 (or s
3035 (format "\C-bERC\C-b %s (IRC client for Emacs)"; - \C-b%s\C-b"
3036 erc-version-string) ; erc-official-location)
3037 ))
3038
3039(defun erc-part-reason-zippy (&optional s)
3040 "Zippy part message.
3041
3042If S is non-nil, it will be used as the quit reason."
3043 (or s
3044 (erc-replace-regexp-in-string "\n" "" (yow))))
3045
3046(defun erc-part-reason-various (s)
3047 "Choose a part reason based on S (a string)."
3048 (when (featurep 'xemacs) (require 'poe))
3049 (let ((res (car (assoc-default (or s "")
3050 erc-part-reason-various-alist 'string-match))))
3051 (cond
3052 ((functionp res) (funcall res))
3053 ((stringp res) res)
3054 (s))))
3055
3056(defun erc-cmd-QUIT (reason)
3057 "Disconnect from the current server.
3058If REASON is omitted, display a default quit message, otherwise display
3059the message given by REASON."
3060 (unless reason
3061 (setq reason ""))
3062 (cond
3063 ((string-match "^\\s-*\\(.*\\)$" reason)
3064 (let* ((s (match-string 1 reason))
3065 (buffer (erc-server-buffer))
3066 (reason (funcall erc-quit-reason (if (equal s "") nil s))))
3067 (with-current-buffer (if (and buffer
3068 (bufferp buffer))
3069 buffer
3070 (current-buffer))
3071 (erc-log (format "cmd: QUIT: %s" reason))
3072 (setq erc-server-quitting t)
3073 (erc-set-active-buffer (erc-server-buffer))
3074 (erc-server-send (format "QUIT :%s" reason)))
3075 (run-hook-with-args 'erc-quit-hook erc-server-process)
3076 (when erc-kill-queries-on-quit
3077 (erc-kill-query-buffers erc-server-process)))
3078 t)
3079 (t nil)))
3080
3081(defalias 'erc-cmd-BYE 'erc-cmd-QUIT)
3082(defalias 'erc-cmd-EXIT 'erc-cmd-QUIT)
3083(defalias 'erc-cmd-SIGNOFF 'erc-cmd-QUIT)
3084(put 'erc-cmd-QUIT 'do-not-parse-args t)
3085
3086(defun erc-cmd-GQUIT (reason)
3087 "Disconnect from all servers at once with the same quit REASON."
3088 (erc-with-all-buffers-of-server nil #'(lambda ()
3089 (and (erc-server-buffer-p)
3090 (erc-server-process-alive)))
3091 (erc-cmd-QUIT reason)))
3092
3093(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT)
3094(put 'erc-cmd-GQUIT 'do-not-parse-args t)
3095
3096(defun erc-cmd-SERVER (server)
3097 "Connect to SERVER, leaving existing connection intact."
3098 (erc-log (format "cmd: SERVER: %s" server))
3099 (condition-case nil
3100 (erc-select :server server :nick (erc-current-nick))
3101 (error
3102 (message "Cannot find host %s." server)
3103 (beep)))
3104 t)
3105
3106(eval-when-compile
3107 (defvar motif-version-string)
3108 (defvar gtk-version-string))
3109
3110(defun erc-cmd-SV ()
3111 "Say the current ERC and Emacs version into channel."
3112 (erc-send-message (format "I'm using ERC %s with %s %s (%s%s%s)!"
3113 erc-version-string
3114 (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
3115 emacs-version
3116 system-configuration
3117 (concat
3118 (cond ((featurep 'motif)
3119 (concat ", " (substring
3120 motif-version-string 4)))
3121 ((featurep 'gtk)
3122 (concat ", GTK+ Version "
3123 gtk-version-string))
3124 ((featurep 'mac-carbon) ", Mac Carbon")
3125 ((featurep 'x-toolkit) ", X toolkit")
3126 (t ""))
3127 (if (and (boundp 'x-toolkit-scroll-bars)
3128 (memq x-toolkit-scroll-bars
3129 '(xaw xaw3d)))
3130 (format ", %s scroll bars"
3131 (capitalize (symbol-name
3132 x-toolkit-scroll-bars)))
3133 "")
3134 (if (featurep 'multi-tty) ", multi-tty" ""))
3135 (concat ", built " erc-emacs-build-time)))
3136 t)
3137
3138(defun erc-cmd-SM ()
3139 "Say the current ERC modes into channel."
3140 (erc-send-message (format "I'm using the following modules: %s!"
3141 (erc-modes)))
3142 t)
3143
3144(defun erc-cmd-SMV ()
3145 "Say the current ERC module versions into channel."
3146 (erc-send-message (format "I'm using the following module revisions: %s!"
3147 (erc-version-modules)))
3148 t)
3149
3150(defun erc-cmd-DEOP (&rest people)
3151 "Remove the operator setting from user(s) given in PEOPLE."
3152 (when (> (length people) 0)
3153 (erc-server-send (concat "MODE " (erc-default-target)
3154 " -"
3155 (make-string (length people) ?o)
3156 " "
3157 (mapconcat 'identity people " ")))
3158 t))
3159
3160(defun erc-cmd-OP (&rest people)
3161 "Add the operator setting to users(s) given in PEOPLE."
3162 (when (> (length people) 0)
3163 (erc-server-send (concat "MODE " (erc-default-target)
3164 " +"
3165 (make-string (length people) ?o)
3166 " "
3167 (mapconcat 'identity people " ")))
3168 t))
3169
3170(defun erc-cmd-TIME (&optional line)
3171 "Request the current time and date from the current server."
3172 (cond
3173 ((and line (string-match "^\\s-*\\(.*\\)$" line))
3174 (let ((args (match-string 1 line)))
3175 (erc-log (format "cmd: TIME: %s" args))
3176 (erc-server-send (concat "TIME " args)))
3177 t)
3178 (t (erc-server-send "TIME"))))
3179(defalias 'erc-cmd-DATE 'erc-cmd-TIME)
3180
3181(defun erc-cmd-TOPIC (topic)
3182 "Set or request the topic for a channel.
3183LINE has the format: \"#CHANNEL TOPIC\", \"#CHANNEL\", \"TOPIC\"
3184or the empty string.
3185
3186If no #CHANNEL is given, the default channel is used. If TOPIC is
3187given, the channel topic is modified, otherwise the current topic will
3188be displayed."
3189 (cond
3190 ;; /topic #channel TOPIC
3191 ((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-\\(.*\\)$" topic)
3192 (let ((ch (match-string 1 topic))
3193 (topic (match-string 2 topic)))
3194 (erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
3195 (erc-server-send (format "TOPIC %s :%s" ch topic) nil ch))
3196 t)
3197 ;; /topic #channel
3198 ((string-match "^\\s-*\\([&#+!]\\S-+\\)" topic)
3199 (let ((ch (match-string 1 topic)))
3200 (erc-server-send (format "TOPIC %s" ch) nil ch)
3201 t))
3202 ;; /topic
3203 ((string-match "^\\s-*$" topic)
3204 (let ((ch (erc-default-target)))
3205 (erc-server-send (format "TOPIC %s" ch) nil ch)
3206 t))
3207 ;; /topic TOPIC
3208 ((string-match "^\\s-*\\(.*\\)$" topic)
3209 (let ((ch (erc-default-target))
3210 (topic (match-string 1 topic)))
3211 (if (and ch (erc-channel-p ch))
3212 (progn
3213 (erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
3214 (erc-server-send (format "TOPIC %s :%s" ch topic) nil ch))
3215 (erc-display-message nil 'error (current-buffer) 'no-target)))
3216 t)
3217 (t nil)))
3218(defalias 'erc-cmd-T 'erc-cmd-TOPIC)
3219(put 'erc-cmd-TOPIC 'do-not-parse-args t)
3220
3221(defun erc-cmd-APPENDTOPIC (topic)
3222 "Append TOPIC to the current channel topic, separated by a space."
3223 (let ((oldtopic erc-channel-topic))
3224 ;; display help when given no arguments
3225 (when (string-match "^\\s-*$" topic)
3226 (signal 'wrong-number-of-arguments nil))
3227 ;; strip trailing ^O
3228 (when (string-match "\\(.*\\)\C-o" oldtopic)
3229 (erc-cmd-TOPIC (concat (match-string 1 oldtopic) topic)))))
3230(defalias 'erc-cmd-AT 'erc-cmd-APPENDTOPIC)
3231(put 'erc-cmd-APPENDTOPIC 'do-not-parse-args t)
3232
3233(defun erc-cmd-CLEARTOPIC (&optional channel)
3234 "Clear the topic for a CHANNEL.
3235If CHANNEL is not specified, clear the topic for the default channel."
3236 (interactive "sClear topic of channel (RET is current channel): ")
3237 (let ((chnl (or (and (erc-channel-p channel) channel) (erc-default-target))))
3238 (when chnl
3239 (erc-server-send (format "TOPIC %s :" chnl))
3240 t)))
3241
3242;;; Banlists
3243
3244(defvar erc-channel-banlist nil
3245 "A list of bans seen for the current channel.
3246
3247Each ban is an alist of the form:
3248 (WHOSET . MASK)
3249
3250The property `received-from-server' indicates whether
3251or not the ban list has been requested from the server.")
3252(make-variable-buffer-local 'erc-channel-banlist)
3253(put 'erc-channel-banlist 'received-from-server nil)
3254
3255(defun erc-cmd-BANLIST ()
3256 "Pretty-print the contents of `erc-channel-banlist'.
3257
3258The ban list is fetched from the server if necessary."
3259 (let ((chnl (erc-default-target))
3260 (chnl-name (buffer-name)))
3261
3262 (cond
3263 ((not (erc-channel-p chnl))
3264 (erc-display-line (erc-make-notice "You're not on a channel\n")
3265 'active))
3266
3267 ((not (get 'erc-channel-banlist 'received-from-server))
3268 (let ((old-367-hook erc-server-367-functions))
3269 (setq erc-server-367-functions 'erc-banlist-store
3270 erc-channel-banlist nil)
3271 ;; fetch the ban list then callback
3272 (with-current-buffer (erc-server-buffer)
3273 (erc-once-with-server-event
3274 368
3275 `(with-current-buffer ,chnl-name
3276 (put 'erc-channel-banlist 'received-from-server t)
3277 (setq erc-server-367-functions ',old-367-hook)
3278 (erc-cmd-BANLIST)
3279 t))
3280 (erc-server-send (format "MODE %s b" chnl)))))
3281
3282 ((null erc-channel-banlist)
3283 (erc-display-line (erc-make-notice
3284 (format "No bans for channel: %s\n" chnl))
3285 'active)
3286 (put 'erc-channel-banlist 'received-from-server nil))
3287
3288 (t
3289 (let* ((erc-fill-column (or (and (boundp 'erc-fill-column)
3290 erc-fill-column)
3291 (and (boundp 'fill-column)
3292 fill-column)
3293 (1- (window-width))))
3294 (separator (make-string erc-fill-column (string-to-char "=")))
3295 (fmt (concat
3296 "%-" (number-to-string (/ erc-fill-column 2)) "s"
3297 "%" (number-to-string (/ erc-fill-column 2)) "s")))
3298
3299 (erc-display-line
3300 (erc-make-notice (format "Ban list for channel: %s\n"
3301 (erc-default-target)))
3302 'active)
3303
3304 (erc-display-line separator 'active)
3305 (erc-display-line (format fmt "Ban Mask" "Banned By") 'active)
3306 (erc-display-line separator 'active)
3307
3308 (mapc
3309 (lambda (x)
3310 (erc-display-line
3311 (format fmt
3312 (truncate-string-to-width (cdr x) (/ erc-fill-column 2))
3313 (if (car x)
3314 (truncate-string-to-width (car x) (/ erc-fill-column 2))
3315 ""))
3316 'active))
3317 erc-channel-banlist)
3318
3319 (erc-display-line (erc-make-notice "End of Ban list")
3320 'active)
3321 (put 'erc-channel-banlist 'received-from-server nil)))))
3322 t)
3323
3324(defalias 'erc-cmd-BL 'erc-cmd-BANLIST)
3325
3326(defun erc-cmd-MASSUNBAN ()
3327 "Mass Unban.
3328
3329Unban all currently banned users in the current channel."
3330 (let ((chnl (erc-default-target)))
3331 (cond
3332
3333 ((not (erc-channel-p chnl))
3334 (erc-display-line
3335 (erc-make-notice "You're not on a channel\n")
3336 'active))
3337
3338 ((not (get 'erc-channel-banlist 'received-from-server))
3339 (let ((old-367-hook erc-server-367-functions))
3340 (setq erc-server-367-functions 'erc-banlist-store)
3341 ;; fetch the ban list then callback
3342 (with-current-buffer (erc-server-buffer)
3343 (erc-once-with-server-event
3344 368
3345 `(with-current-buffer ,chnl
3346 (put 'erc-channel-banlist 'received-from-server t)
3347 (setq erc-server-367-functions ,old-367-hook)
3348 (erc-cmd-MASSUNBAN)
3349 t))
3350 (erc-server-send (format "MODE %s b" chnl)))))
3351
3352 (t (let ((bans (mapcar 'cdr erc-channel-banlist)))
3353 (when bans
3354 ;; Glob the bans into groups of three, and carry out the unban.
3355 ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@*
3356 (mapc
3357 (lambda (x)
3358 (erc-server-send
3359 (format "MODE %s -%s %s" (erc-default-target)
3360 (make-string (length x) (string-to-char "b"))
3361 (mapconcat 'identity x " "))))
3362 (erc-group-list bans 3))))
3363 t))))
3364
3365(defalias 'erc-cmd-MUB 'erc-cmd-MASSUNBAN)
3366
3367;;;; End of IRC commands
3368
3369(defun erc-ensure-channel-name (channel)
3370 "Return CHANNEL if it is a valid channel name.
3371Eventually add a # in front of it, if that turns it into a valid channel name."
3372 (if (erc-channel-p channel)
3373 channel
3374 (concat "#" channel)))
3375
3376(defun erc-grab-region (start end)
3377 "Copy the region between START and END in a recreatable format.
3378
3379Converts all the IRC text properties in each line of the region
3380into control codes and writes them to a separate buffer. The
3381resulting text may be used directly as a script to generate this
3382text again."
3383 (interactive "r")
3384 (erc-set-active-buffer (current-buffer))
3385 (save-excursion
3386 (let* ((cb (current-buffer))
3387 (buf (generate-new-buffer erc-grab-buffer-name))
3388 (region (buffer-substring start end))
3389 (lines (erc-split-multiline-safe region)))
3390 (set-buffer buf)
3391 (dolist (line lines)
3392 (insert (concat line "\n")))
3393 (set-buffer cb)
3394 (switch-to-buffer-other-window buf)))
3395 (message "erc-grab-region doesn't grab colors etc. anymore. If you use this, please tell the maintainers.")
3396 (ding))
3397
3398(defun erc-display-prompt (&optional buffer pos prompt face)
3399 "Display PROMPT in BUFFER at position POS.
3400Display an ERC prompt in BUFFER.
3401
3402If PROMPT is nil, one is constructed with the function `erc-prompt'.
3403If BUFFER is nil, the `current-buffer' is used.
3404If POS is nil, PROMPT will be displayed at `point'.
3405If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
3406`erc-prompt-face' will be used."
3407 (let* ((prompt (or prompt (erc-prompt)))
3408 (l (length prompt))
3409 (ob (current-buffer)))
3410 ;; We cannot use save-excursion because we move point, therefore
3411 ;; we resort to the ol' ob trick to restore this.
3412 (when (and buffer (bufferp buffer))
3413 (set-buffer buffer))
3414
3415 ;; now save excursion again to store where point and mark are
3416 ;; in the current buffer
3417 (save-excursion
3418 (setq pos (or pos (point)))
3419 (goto-char pos)
3420 (when (> l 0)
3421 ;; Do not extend the text properties when typing at the end
3422 ;; of the prompt, but stuff typed in front of the prompt
3423 ;; shall remain part of the prompt.
3424 (setq prompt (erc-propertize prompt
3425 'start-open t ; XEmacs
3426 'rear-nonsticky t ; Emacs
3427 'erc-prompt t
3428 'front-sticky t
3429 'read-only t))
3430 (erc-put-text-property 0 (1- (length prompt))
3431 'face (or face 'erc-prompt-face)
3432 prompt)
3433 (insert prompt))
3434 ;; Set the input marker
3435 (set-marker erc-input-marker (point)))
3436
3437 ;; Now we are back at the old position. If the prompt was
3438 ;; inserted here or before us, advance point by the length of
3439 ;; the prompt.
3440 (when (or (not pos) (<= (point) pos))
3441 (forward-char l))
3442 ;; Clear the undo buffer now, so the user can undo his stuff,
3443 ;; but not the stuff we did. Sneaky!
3444 (setq buffer-undo-list nil)
3445 (set-buffer ob)))
3446
3447;; interactive operations
3448
3449(defun erc-input-message ()
3450 "Read input from the minibuffer."
3451 (interactive)
3452 (let ((minibuffer-allow-text-properties t)
3453 (read-map minibuffer-local-map))
3454 (insert (read-from-minibuffer "Message: "
3455 (string last-command-char) read-map))
3456 (erc-send-current-line)))
3457
3458(defvar erc-action-history-list ()
3459 "History list for interactive action input.")
3460
3461(defun erc-input-action ()
3462 "Interactively input a user action and send it to IRC."
3463 (interactive "")
3464 (erc-set-active-buffer (current-buffer))
3465 (let ((action (read-from-minibuffer
3466 "Action: " nil nil nil 'erc-action-history-list)))
3467 (if (not (string-match "^\\s-*$" action))
3468 (erc-send-action (erc-default-target) action))))
3469
3470(defun erc-join-channel (channel &optional key)
3471 "Join CHANNEL.
3472
3473If `point' is at the beginning of a channel name, use that as default."
3474 (interactive
3475 (list
3476 (let ((chnl (if (looking-at "\\([&#+!][^ ]+\\)") (match-string 1) ""))
3477 (table (when (erc-server-buffer-live-p)
3478 (set-buffer (process-buffer erc-server-process))
3479 erc-channel-list)))
3480 (completing-read "Join channel: " table nil nil nil nil chnl))
3481 (when erc-prompt-for-channel-key
3482 (read-from-minibuffer "Channel key (RET for none): " nil))))
3483 (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
3484
3485(defun erc-part-from-channel (reason)
3486 "Part from the current channel and prompt for a REASON."
3487 (interactive
3488 (list
3489 (if (and (boundp 'reason) (stringp reason) (not (string= reason "")))
3490 reason
3491 (read-from-minibuffer (concat "Leave " (erc-default-target)
3492 ", Reason? ")
3493 (cons "No reason" 0)))))
3494 (erc-cmd-PART (concat (erc-default-target)" " reason)))
3495
3496(defun erc-set-topic (topic)
3497 "Prompt for a TOPIC for the current channel."
3498 (interactive
3499 (list
3500 (read-from-minibuffer
3501 (concat "Set topic of " (erc-default-target) ": ")
3502 (when erc-channel-topic
3503 (cons (apply 'concat (butlast (split-string erc-channel-topic "\C-o")))
3504 0)))))
3505 (let ((topic-list (split-string topic "\C-o"))) ; strip off the topic setter
3506 (erc-cmd-TOPIC (concat (erc-default-target) " " (car topic-list)))))
3507
3508(defun erc-set-channel-limit (&optional limit)
3509 "Set a LIMIT for the current channel. Remove limit if nil.
3510Prompt for one if called interactively."
3511 (interactive (list (read-from-minibuffer
3512 (format "Limit for %s (RET to remove limit): "
3513 (erc-default-target)))))
3514 (let ((tgt (erc-default-target)))
3515 (if (and limit (>= (length limit) 1))
3516 (erc-server-send (format "MODE %s +l %s" tgt limit))
3517 (erc-server-send (format "MODE %s -l" tgt)))))
3518
3519(defun erc-set-channel-key (&optional key)
3520 "Set a KEY for the current channel. Remove key if nil.
3521Prompt for one if called interactively."
3522 (interactive (list (read-from-minibuffer
3523 (format "Key for %s (RET to remove key): "
3524 (erc-default-target)))))
3525 (let ((tgt (erc-default-target)))
3526 (if (and key (>= (length key) 1))
3527 (erc-server-send (format "MODE %s +k %s" tgt key))
3528 (erc-server-send (format "MODE %s -k" tgt)))))
3529
3530(defun erc-quit-server (reason)
3531 "Disconnect from current server after prompting for REASON.
3532`erc-quit-reason' works with this just like with `erc-cmd-QUIT'."
3533 (interactive (list (read-from-minibuffer
3534 (format "Reason for quitting %s: "
3535 (or erc-server-announced-name
3536 erc-session-server)))))
3537 (erc-cmd-QUIT reason))
3538
3539;; Movement of point
3540
3541(defun erc-bol ()
3542 "Move `point' to the beginning of the current line.
3543
3544This places `point' just after the prompt, or at the beginning of the line."
3545 (interactive)
3546 (forward-line 0)
3547 (when (get-text-property (point) 'erc-prompt)
3548 (goto-char erc-input-marker))
3549 (point))
3550
3551(defun erc-kill-input ()
3552 "Kill current input line using `erc-bol' followed by `kill-line'."
3553 (interactive)
3554 (when (and (erc-bol)
3555 (/= (point) (point-max))) ;; Prevent a (ding) and an error when
3556 ;; there's nothing to kill
3557 (if (boundp 'erc-input-ring-index)
3558 (setq erc-input-ring-index nil))
3559 (kill-line)))
3560
3561(defun erc-complete-word ()
3562 "Complete the word before point.
3563
3564This function uses `erc-complete-functions'."
3565 (interactive)
3566 (unless (run-hook-with-args-until-success 'erc-complete-functions)
3567 (beep)))
3568
3569;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3570;;
3571;; IRC SERVER INPUT HANDLING
3572;;
3573;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3574
3575;;;; New Input parsing
3576
3577; Stolen from ZenIRC. I just wanna test this code, so here is
3578; experiment area.
3579
3580(defcustom erc-default-server-hook '(erc-debug-missing-hooks
3581 erc-default-server-handler)
3582 "*Default for server messages which aren't covered by `erc-server-hooks'."
3583 :group 'erc-server-hooks
3584 :type 'hook)
3585
3586(defun erc-default-server-handler (proc parsed)
3587 "Default server handler.
3588
3589Displays PROC and PARSED appropriately using `erc-display-message'."
3590 (erc-display-message
3591 parsed 'notice proc
3592 (mapconcat
3593 'identity
3594 (let (res)
3595 (mapc #'(lambda (x)
3596 (if (stringp x)
3597 (setq res (append res (list x)))))
3598 parsed)
3599 res)
3600 " ")))
3601
3602(defvar erc-server-vectors
3603 '(["msgtype" "sender" "to" "arg1" "arg2" "arg3" "..."])
3604 "List of received server messages which ERC does not specifically handle.
3605See `erc-debug-missing-hooks'.")
3606;(make-variable-buffer-local 'erc-server-vectors)
3607
3608(defun erc-debug-missing-hooks (proc parsed)
3609 "Add PARSED server message ERC does not yet handle to `erc-server-vectors'.
3610These vectors can be helpful when adding new server message handlers to ERC.
3611See `erc-default-server-hook'."
3612 (nconc erc-server-vectors (list parsed))
3613 nil)
3614
3615(defun erc-query (target server)
3616 "Open a query buffer on TARGET, using SERVER.
3617To change how this query window is displayed, use `let' to bind
3618`erc-join-buffer' before calling this."
3619 (unless (and server
3620 (buffer-live-p server)
3621 (set-buffer server))
3622 (error "Couldn't switch to server buffer"))
3623 (let ((buf (erc erc-session-server
3624 erc-session-port
3625 (erc-current-nick)
3626 erc-session-user-full-name
3627 nil
3628 nil
3629 (list target)
3630 target
3631 erc-server-process)))
3632 (unless buf
3633 (error "Couldn't open query window"))
3634 (erc-update-mode-line)
3635 buf))
3636
3637(defcustom erc-auto-query nil
3638 "If non-nil, create a query buffer each time you receive a private message.
3639
3640If the buffer doesn't already exist it is created. This can be
3641set to a symbol, to control how the new query window should
3642appear. See the documentation for `erc-join-buffer' for
3643available choices."
3644 :group 'erc-query
3645 :type '(choice (const nil)
3646 (const buffer)
3647 (const window)
3648 (const window-noselect)
3649 (const bury)
3650 (const frame)))
3651
3652(defcustom erc-query-on-unjoined-chan-privmsg t
3653 "If non-nil create query buffer on receiving any PRIVMSG at all.
3654This includes PRIVMSGs directed to channels. If you are using an IRC
3655bouncer, such as dircproxy, to keep a log of channels when you are
3656disconnected, you should set this option to t."
3657 :group 'erc-query
3658 :type 'boolean)
3659
3660(defcustom erc-format-query-as-channel-p t
3661 "If non-nil, format text from others in a query buffer like in a channel,
3662otherwise format like a private message."
3663 :group 'erc-query
3664 :type 'boolean)
3665
3666(defcustom erc-minibuffer-notice nil
3667 "If non-nil, print ERC notices for the user in the minibuffer.
3668Only happens when the session buffer isn't visible."
3669 :group 'erc-display
3670 :type 'boolean)
3671
3672(defcustom erc-minibuffer-ignored nil
3673 "If non-nil, print a message in the minibuffer if we ignored something."
3674 :group 'erc-ignore
3675 :type 'boolean)
3676
3677(defun erc-wash-quit-reason (reason nick login host)
3678 "Remove duplicate text from quit REASON.
3679Specifically in relation to NICK (user@host) information. Returns REASON
3680unmodified if nothing can be removed.
3681E.g. \"Read error to Nick [user@some.host]: 110\" would be shortened to
3682\"Read error: 110\". The same applies for \"Ping Timeout\"."
3683 (setq nick (regexp-quote nick)
3684 login (regexp-quote login)
3685 host (regexp-quote host))
3686 (or (when (string-match (concat "^\\(Read error\\) to "
3687 nick "\\[" host "\\]: "
3688 "\\(.+\\)$") reason)
3689 (concat (match-string 1 reason) ": " (match-string 2 reason)))
3690 (when (string-match (concat "^\\(Ping timeout\\) for "
3691 nick "\\[" host "\\]$") reason)
3692 (match-string 1 reason))
3693 reason))
3694
3695(defun erc-nickname-in-use (nick reason)
3696 "If NICK is unavailable, tell the user the REASON.
3697
3698See also `erc-display-error-notice'."
3699 (if (or erc-manual-set-nick-on-bad-nick-p
3700 ;; how many default-nicks are left + one more try...
3701 (eq erc-nick-change-attempt-count
3702 (if (consp erc-nick)
3703 (+ (length erc-nick) 1)
3704 1)))
3705 (erc-display-error-notice
3706 nil
3707 (format "Nickname %s is %s, try another." nick reason))
3708 (setq erc-nick-change-attempt-count (+ erc-nick-change-attempt-count 1))
3709 (let ((newnick (nth 1 erc-default-nicks))
3710 (nicklen (cdr (assoc "NICKLEN"
3711 (with-current-buffer (erc-server-buffer)
3712 erc-server-parameters)))))
3713 (setq erc-bad-nick t)
3714 ;; try to use a different nick
3715 (if erc-default-nicks
3716 (setq erc-default-nicks (cdr erc-default-nicks)))
3717 (if (not newnick)
3718 (setq newnick (concat (truncate-string-to-width
3719 nick
3720 (if (and erc-server-connected nicklen)
3721 (- (string-to-number nicklen) 1)
3722 ;; rfc2812 max nick length = 9
3723 ;; we must assume this is the
3724 ;; server's setting if we haven't
3725 ;; established a connection yet
3726 8))
3727 erc-nick-uniquifier)))
3728 (erc-cmd-NICK newnick)
3729 (erc-display-error-notice
3730 nil
3731 (format "Nickname %s is %s, trying %s"
3732 nick reason newnick)))))
3733
3734;;; Server messages
3735
3736(defgroup erc-server-hooks nil
3737 "Server event callbacks.
3738Every server event - like numeric replies - has it's own hook.
3739Those hooks are all called using `run-hook-with-args-until-success'.
3740They receive as first argument the process object from where the event
3741originated from,
3742and as second argument the event parsed as a vector."
3743 :group 'erc-hooks)
3744
3745(defun erc-display-server-message (proc parsed)
3746 "Display the message sent by the server as a notice."
3747 (erc-display-message
3748 parsed 'notice 'active (erc-response.contents parsed)))
3749
3750(defun erc-auto-query (proc parsed)
3751 ;; FIXME: This needs more documentation, unless it's not a user function --
3752 ;; Lawrence 2004-01-08
3753 "Put this on `erc-server-PRIVMSG-functions'."
3754 (when erc-auto-query
3755 (let* ((nick (car (erc-parse-user (erc-response.sender parsed))))
3756 (target (car (erc-response.command-args parsed)))
3757 (msg (erc-response.contents parsed))
3758 (query (if (not erc-query-on-unjoined-chan-privmsg)
3759 nick
3760 (if (erc-current-nick-p target)
3761 nick
3762 target))))
3763 (and (not (erc-ignored-user-p (erc-response.sender parsed)))
3764 (or erc-query-on-unjoined-chan-privmsg
3765 (string= target (erc-current-nick)))
3766 (not (erc-get-buffer query proc))
3767 (not (erc-is-message-ctcp-and-not-action-p msg))
3768 (let ((erc-join-buffer erc-auto-query))
3769 (erc-cmd-QUERY query))
3770 nil))))
3771
3772(defun erc-is-message-ctcp-p (message)
3773 "Check if MESSAGE is a CTCP message or not."
3774 (string-match "^\C-a\\([^\C-a]*\\)\C-a?$" message))
3775
3776(defun erc-is-message-ctcp-and-not-action-p (message)
3777 "Check if MESSAGE is a CTCP message or not."
3778 (and (erc-is-message-ctcp-p message)
3779 (not (string-match "^\C-a\\ACTION.*\C-a$" message))))
3780
3781(defun erc-format-privmessage (nick msg privp msgp)
3782 "Format a PRIVMSG in an insertible fashion."
3783 (let* ((mark-s (if msgp (if privp "*" "<") "-"))
3784 (mark-e (if msgp (if privp "*" ">") "-"))
3785 (str (format "%s%s%s %s" mark-s nick mark-e msg))
3786 (nick-face (if privp 'erc-nick-msg-face 'erc-nick-default-face))
3787 (msg-face (if privp 'erc-direct-msg-face 'erc-default-face)))
3788 ;; add text properties to text before the nick, the nick and after the nick
3789 (erc-put-text-property 0 (length mark-s) 'face msg-face str)
3790 (erc-put-text-property (length mark-s) (+ (length mark-s) (length nick))
3791 'face nick-face str)
3792 (erc-put-text-property (+ (length mark-s) (length nick)) (length str)
3793 'face msg-face str)
3794 str))
3795
3796(defcustom erc-format-nick-function 'erc-format-nick
3797 "*Function to format a nickname for message display."
3798 :group 'erc-display
3799 :type 'function)
3800
3801(defun erc-format-nick (&optional user channel-data)
3802 "Standard nickname formatting function. Only returns the value
3803of NICK."
3804 (if user
3805 (erc-server-user-nickname user)))
3806
3807(defun erc-format-@nick (&optional user channel-data)
3808 "Format a nickname such that @ or + are prefix for the NICK
3809if OP or VOICE are t respectively."
3810 (if user
3811 (let (op voice)
3812 (if channel-data
3813 (setq op (erc-channel-user-op channel-data)
3814 voice (erc-channel-user-voice channel-data)))
3815 (concat (if voice "+" "")
3816 (if op "@" "")
3817 (erc-server-user-nickname user)))))
3818
3819(defun erc-format-my-nick ()
3820 "Return the beginning of this user's message, correctly propertized"
3821 (if erc-show-my-nick
3822 (let ((open "<")
3823 (close "> ")
3824 (nick (erc-current-nick)))
3825 (concat
3826 (erc-propertize open 'face 'erc-default-face)
3827 (erc-propertize nick 'face 'erc-nick-default-face)
3828 (erc-propertize close 'face 'erc-default-face)))
3829 (let ((prefix "> "))
3830 (erc-propertize prefix 'face 'erc-default-face))))
3831
3832(defun erc-echo-notice-in-default-buffer (s parsed buffer sender)
3833 "Echos a private notice in the default buffer, namely the
3834target buffer specified by BUFFER, or there is no target buffer,
3835the server buffer. This function is designed to be added to
3836either `erc-echo-notice-hook' or `erc-echo-notice-always-hook',
3837and always returns t."
3838 (erc-display-message parsed nil buffer s)
3839 t)
3840
3841(defun erc-echo-notice-in-target-buffer (s parsed buffer sender)
3842 "Echos a private notice in BUFFER, if BUFFER is non-nil. This
3843function is designed to be added to either `erc-echo-notice-hook'
3844or `erc-echo-notice-always-hook', and returns non-nil iff BUFFER
3845is non-nil."
3846 (if buffer
3847 (progn (erc-display-message parsed nil buffer s) t)
3848 nil))
3849
3850(defun erc-echo-notice-in-minibuffer (s parsed buffer sender)
3851 "Echos a private notice in the minibuffer. This function is
3852designed to be added to either `erc-echo-notice-hook' or
3853`erc-echo-notice-always-hook', and always returns t."
3854 (message "%s" (concat "NOTICE: " s))
3855 t)
3856
3857(defun erc-echo-notice-in-server-buffer (s parsed buffer sender)
3858 "Echos a private notice in the server buffer. This function is
3859designed to be added to either `erc-echo-notice-hook' or
3860`erc-echo-notice-always-hook', and always returns t."
3861 (erc-display-message parsed nil nil s)
3862 t)
3863
3864(defun erc-echo-notice-in-active-non-server-buffer (s parsed buffer sender)
3865 "Echos a private notice in the active buffer if the active
3866buffer is not the server buffer. This function is designed to be
3867added to either `erc-echo-notice-hook' or
3868`erc-echo-notice-always-hook', and returns non-nil iff the active
3869buffer is not the server buffer."
3870 (if (not (eq (erc-server-buffer) (erc-active-buffer)))
3871 (progn (erc-display-message parsed nil 'active s) t)
3872 nil))
3873
3874(defun erc-echo-notice-in-active-buffer (s parsed buffer sender)
3875 "Echos a private notice in the active buffer. This function is
3876designed to be added to either `erc-echo-notice-hook' or
3877`erc-echo-notice-always-hook', and always returns t."
3878 (erc-display-message parsed nil 'active s)
3879 t)
3880
3881(defun erc-echo-notice-in-user-buffers (s parsed buffer sender)
3882 "Echos a private notice in all of the buffers for which SENDER
3883is a member. This function is designed to be added to either
3884`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
3885returns non-nil iff there is at least one buffer for which the
3886sender is a member.
3887
3888See also: `erc-echo-notice-in-first-user-buffer',
3889`erc-buffer-list-with-nick'"
3890 (let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
3891 (if buffers
3892 (progn (erc-display-message parsed nil buffers s) t)
3893 nil)))
3894
3895(defun erc-echo-notice-in-user-and-target-buffers (s parsed buffer sender)
3896 "Echos a private notice in BUFFER and in all of the buffers for
3897which SENDER is a member. This function is designed to be added
3898to either `erc-echo-notice-hook' or
3899`erc-echo-notice-always-hook', and returns non-nil iff there is
3900at least one buffer for which the sender is a member or the
3901default target.
3902
3903See also: `erc-echo-notice-in-user-buffers',
3904`erc-buffer-list-with-nick'"
3905 (let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
3906 (add-to-list 'buffers buffer)
3907 (if buffers
3908 (progn (erc-display-message parsed nil buffers s) t)
3909 nil)))
3910
3911(defun erc-echo-notice-in-first-user-buffer (s parsed buffer sender)
3912 "Echos a private notice in one of the buffers for which SENDER
3913is a member. This function is designed to be added to either
3914`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
3915returns non-nil iff there is at least one buffer for which the
3916sender is a member.
3917
3918See also: `erc-echo-notice-in-user-buffers',
3919`erc-buffer-list-with-nick'"
3920 (let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
3921 (if buffers
3922 (progn (erc-display-message parsed nil (car buffers) s) t)
3923 nil)))
3924
3925;;; Ban manipulation
3926
3927(defun erc-banlist-store (proc parsed)
3928 "Record ban entries for a channel."
3929 (multiple-value-bind (channel mask whoset)
3930 (cdr (erc-response.command-args parsed))
3931 ;; Determine to which buffer the message corresponds
3932 (let ((buffer (erc-get-buffer channel proc)))
3933 (with-current-buffer buffer
3934 (unless (member (cons whoset mask) erc-channel-banlist)
3935 (setq erc-channel-banlist (cons (cons whoset mask)
3936 erc-channel-banlist))))))
3937 nil)
3938
3939(defun erc-banlist-finished (proc parsed)
3940 "Record that we have received the banlist."
3941 (let* ((channel (second (erc-response.command-args parsed)))
3942 (buffer (erc-get-buffer channel proc)))
3943 (with-current-buffer buffer
3944 (put 'erc-channel-banlist 'received-from-server t)))
3945 t) ; suppress the 'end of banlist' message
3946
3947(defun erc-banlist-update (proc parsed)
3948 "Check MODE commands for bans and update the banlist appropriately."
3949 ;; FIXME: Possibly incorrect. -- Lawrence 2004-05-11
3950 (let* ((tgt (first (erc-response.command-args parsed)))
3951 (mode (erc-response.contents parsed))
3952 (whoset (erc-response.sender parsed))
3953 (buffer (erc-get-buffer tgt proc)))
3954 (when buffer
3955 (with-current-buffer buffer
3956 (cond ((not (get 'erc-channel-banlist 'received-from-server)) nil)
3957 ((string-match "^\\([+-]\\)b" mode)
3958 ;; This is a ban
3959 (cond
3960 ((string-match "^-" mode)
3961 ;; Remove the unbanned masks from the ban list
3962 (setq erc-channel-banlist
3963 (erc-delete-if
3964 #'(lambda (y)
3965 (member (upcase (cdr y))
3966 (mapcar #'upcase
3967 (cdr (split-string mode)))))
3968 erc-channel-banlist)))
3969 ((string-match "^+" mode)
3970 ;; Add the banned mask(s) to the ban list
3971 (mapc
3972 (lambda (mask)
3973 (unless (member (cons whoset mask) erc-channel-banlist)
3974 (setq erc-channel-banlist
3975 (cons (cons whoset mask) erc-channel-banlist))))
3976 (cdr (split-string mode))))))))))
3977 nil)
3978
3979;; used for the banlist cmds
3980(defun erc-group-list (list n)
3981 "Group LIST into sublists of length N."
3982 (cond ((null list) nil)
3983 ((null (nthcdr n list)) (list list))
3984 (t (cons (erc-subseq list 0 n) (erc-group-list (nthcdr n list) n)))))
3985
3986
3987;;; MOTD numreplies
3988
3989(defun erc-handle-login ()
3990 "Handle the logging in process of connection."
3991 (unless erc-logged-in
3992 (setq erc-logged-in t)
3993 (message "Logging in as \'%s\'... done" (erc-current-nick))
3994 ;; execute a startup script
3995 (let ((f (erc-select-startup-file)))
3996 (when f
3997 (erc-load-script f)))))
3998
3999(defun erc-connection-established (proc parsed)
4000 "Run just after connection.
4001
4002Set user modes and run `erc-after-connect hook'."
4003 (unless erc-server-connected ; only once per session
4004 (let ((server (or erc-server-announced-name (erc-response.sender parsed)))
4005 (nick (car (erc-response.command-args parsed ))))
4006 (setq erc-server-connected t)
4007 (erc-update-mode-line)
4008 (erc-set-initial-user-mode nick)
4009 (erc-server-setup-periodical-server-ping)
4010 (run-hook-with-args 'erc-after-connect server nick))))
4011
4012(defun erc-set-initial-user-mode (nick)
4013 "If `erc-user-mode' is non-nil for NICK, set the user modes."
4014 (when erc-user-mode
4015 (let ((mode (if (functionp erc-user-mode)
4016 (funcall erc-user-mode)
4017 erc-user-mode)))
4018 (when (stringp mode)
4019 (erc-log (format "changing mode for %s to %s" nick mode))
4020 (erc-server-send (format "MODE %s %s" nick mode))))))
4021
4022(defun erc-display-error-notice (parsed string)
4023 "Display STRING as an error notice.
4024
4025See also `erc-display-message'."
4026 (erc-display-message
4027 parsed '(notice error) 'active string))
4028
4029(defun erc-process-ctcp-query (proc parsed nick login host)
4030 ;; FIXME: This needs a proper docstring -- Lawrence 2004-01-08
4031 "Process a CTCP query."
4032 (let ((queries (delete "" (split-string (erc-response.contents parsed)
4033 "\C-a"))))
4034 (if (> (length queries) 4)
4035 (erc-display-message
4036 parsed (list 'notice 'error) proc 'ctcp-too-many)
4037 (if (= 0 (length queries))
4038 (erc-display-message
4039 parsed (list 'notice 'error) proc
4040 'ctcp-empty ?n nick)
4041 (while queries
4042 (let* ((type (upcase (car (split-string (car queries)))))
4043 (hook (intern-soft (concat "erc-ctcp-query-" type "-hook"))))
4044 (if (and hook (boundp hook))
4045 (if (string-equal type "ACTION")
4046 (run-hook-with-args-until-success
4047 hook proc parsed nick login host
4048 (car (erc-response.command-args parsed))
4049 (car queries))
4050 (when erc-paranoid
4051 (if (erc-current-nick-p
4052 (car (erc-response.command-args parsed)))
4053 (erc-display-message
4054 parsed 'error 'active 'ctcp-request
4055 ?n nick ?u login ?h host ?r (car queries))
4056 (erc-display-message
4057 parsed 'error 'active 'ctcp-request-to
4058 ?n nick ?u login ?h host ?r (car queries)
4059 ?t (car (erc-response.command-args parsed)))))
4060 (run-hook-with-args-until-success
4061 hook proc nick login host
4062 (car (erc-response.command-args parsed))
4063 (car queries)))
4064 (erc-display-message
4065 parsed (list 'notice 'error) proc
4066 'undefined-ctcp)))
4067 (setq queries (cdr queries)))))))
4068
4069(defvar erc-ctcp-query-ACTION-hook '(erc-ctcp-query-ACTION))
4070
4071(defun erc-ctcp-query-ACTION (proc parsed nick login host to msg)
4072 "Respond to a CTCP ACTION query."
4073 (when (string-match "^ACTION\\s-\\(.*\\)\\s-*$" msg)
4074 (let ((s (match-string 1 msg))
4075 (buf (or (erc-get-buffer to proc)
4076 (erc-get-buffer nick proc)
4077 (process-buffer proc))))
4078 (erc-display-message
4079 parsed 'action buf
4080 'ACTION ?n nick ?u login ?h host ?a s))))
4081
4082(defvar erc-ctcp-query-CLIENTINFO-hook '(erc-ctcp-query-CLIENTINFO))
4083
4084(defun erc-ctcp-query-CLIENTINFO (proc nick login host to msg)
4085 "Respond to a CTCP CLIENTINFO query."
4086 (when (string-match "^CLIENTINFO\\(\\s-*\\|\\s-+.*\\)$" msg)
4087 (let ((s (erc-client-info (erc-trim-string (match-string 1 msg)))))
4088 (unless erc-disable-ctcp-replies
4089 (erc-send-ctcp-notice nick (format "CLIENTINFO %s" s)))))
4090 nil)
4091
4092(defvar erc-ctcp-query-ECHO-hook '(erc-ctcp-query-ECHO))
4093(defun erc-ctcp-query-ECHO (proc nick login host to msg)
4094 "Respond to a CTCP ECHO query."
4095 (when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg)
4096 (let ((s (match-string 1 msg)))
4097 (unless erc-disable-ctcp-replies
4098 (erc-send-ctcp-notice nick (format "ECHO %s" s)))))
4099 nil)
4100
4101(defvar erc-ctcp-query-FINGER-hook '(erc-ctcp-query-FINGER))
4102(defun erc-ctcp-query-FINGER (proc nick login host to msg)
4103 "Respond to a CTCP FINGER query."
4104 (unless erc-disable-ctcp-replies
4105 (let ((s (if erc-anonymous-login
4106 (format "FINGER I'm %s." (erc-current-nick))
4107 (format "FINGER %s (%s@%s)."
4108 (user-full-name)
4109 (user-login-name)
4110 (system-name))))
4111 (ns (erc-time-diff erc-server-last-sent-time (erc-current-time))))
4112 (when (> ns 0)
4113 (setq s (concat s " Idle for " (erc-sec-to-time ns))))
4114 (erc-send-ctcp-notice nick s)))
4115 nil)
4116
4117(defvar erc-ctcp-query-PING-hook '(erc-ctcp-query-PING))
4118(defun erc-ctcp-query-PING (proc nick login host to msg)
4119 "Respond to a CTCP PING query."
4120 (when (string-match "^PING\\s-+\\(.*\\)" msg)
4121 (unless erc-disable-ctcp-replies
4122 (let ((arg (match-string 1 msg)))
4123 (erc-send-ctcp-notice nick (format "PING %s" arg)))))
4124 nil)
4125
4126(defvar erc-ctcp-query-TIME-hook '(erc-ctcp-query-TIME))
4127(defun erc-ctcp-query-TIME (proc nick login host to msg)
4128 "Respond to a CTCP TIME query."
4129 (unless erc-disable-ctcp-replies
4130 (erc-send-ctcp-notice nick (format "TIME %s" (current-time-string))))
4131 nil)
4132
4133(defvar erc-ctcp-query-USERINFO-hook '(erc-ctcp-query-USERINFO))
4134(defun erc-ctcp-query-USERINFO (proc nick login host to msg)
4135 "Respond to a CTCP USERINFO query."
4136 (unless erc-disable-ctcp-replies
4137 (erc-send-ctcp-notice nick (format "USERINFO %s" erc-user-information)))
4138 nil)
4139
4140(defvar erc-ctcp-query-VERSION-hook '(erc-ctcp-query-VERSION))
4141(defun erc-ctcp-query-VERSION (proc nick login host to msg)
4142 "Respond to a CTCP VERSION query."
4143 (unless erc-disable-ctcp-replies
4144 (erc-send-ctcp-notice
4145 nick (format
4146 "VERSION \C-bERC\C-b %s - an IRC client for emacs (\C-b%s\C-b)"
4147 erc-version-string
4148 erc-official-location)))
4149 nil)
4150
4151(defun erc-process-ctcp-reply (proc parsed nick login host msg)
4152 "Process MSG as a CTCP reply."
4153 (let* ((type (car (split-string msg)))
4154 (hook (intern (concat "erc-ctcp-reply-" type "-hook"))))
4155 (if (boundp hook)
4156 (run-hook-with-args-until-success
4157 hook proc nick login host
4158 (car (erc-response.command-args parsed)) msg)
4159 (erc-display-message
4160 parsed 'notice 'active
4161 'CTCP-UNKNOWN ?n nick ?u login ?h host ?m msg))))
4162
4163(defvar erc-ctcp-reply-ECHO-hook '(erc-ctcp-reply-ECHO))
4164(defun erc-ctcp-reply-ECHO (proc nick login host to msg)
4165 "Handle a CTCP ECHO reply."
4166 (when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg)
4167 (let ((message (match-string 1 msg)))
4168 (erc-display-message
4169 nil '(notice action) 'active
4170 'CTCP-ECHO ?n nick ?m message)))
4171 nil)
4172
4173(defvar erc-ctcp-reply-CLIENTINFO-hook '(erc-ctcp-reply-CLIENTINFO))
4174(defun erc-ctcp-reply-CLIENTINFO (proc nick login host to msg)
4175 "Handle a CTCP CLIENTINFO reply."
4176 (when (string-match "^CLIENTINFO\\s-+\\(.*\\)\\s-*$" msg)
4177 (let ((message (match-string 1 msg)))
4178 (erc-display-message
4179 nil 'notice 'active
4180 'CTCP-CLIENTINFO ?n nick ?m message)))
4181 nil)
4182
4183(defvar erc-ctcp-reply-FINGER-hook '(erc-ctcp-reply-FINGER))
4184(defun erc-ctcp-reply-FINGER (proc nick login host to msg)
4185 "Handle a CTCP FINGER reply."
4186 (when (string-match "^FINGER\\s-+\\(.*\\)\\s-*$" msg)
4187 (let ((message (match-string 1 msg)))
4188 (erc-display-message
4189 nil 'notice 'active
4190 'CTCP-FINGER ?n nick ?m message)))
4191 nil)
4192
4193(defvar erc-ctcp-reply-PING-hook '(erc-ctcp-reply-PING))
4194(defun erc-ctcp-reply-PING (proc nick login host to msg)
4195 "Handle a CTCP PING reply."
4196 (if (not (string-match "^PING\\s-+\\([0-9.]+\\)" msg))
4197 nil
4198 (let ((time (match-string 1 msg)))
4199 (condition-case nil
4200 (let ((delta (erc-time-diff (string-to-number time)
4201 (erc-current-time))))
4202 (erc-display-message
4203 nil 'notice 'active
4204 'CTCP-PING ?n nick
4205 ?t (erc-sec-to-time delta)))
4206 (range-error
4207 (erc-display-message
4208 nil 'error 'active
4209 'bad-ping-response ?n nick ?t time))))))
4210
4211(defvar erc-ctcp-reply-TIME-hook '(erc-ctcp-reply-TIME))
4212(defun erc-ctcp-reply-TIME (proc nick login host to msg)
4213 "Handle a CTCP TIME reply."
4214 (when (string-match "^TIME\\s-+\\(.*\\)\\s-*$" msg)
4215 (let ((message (match-string 1 msg)))
4216 (erc-display-message
4217 nil 'notice 'active
4218 'CTCP-TIME ?n nick ?m message)))
4219 nil)
4220
4221(defvar erc-ctcp-reply-VERSION-hook '(erc-ctcp-reply-VERSION))
4222(defun erc-ctcp-reply-VERSION (proc nick login host to msg)
4223 "Handle a CTCP VERSION reply."
4224 (when (string-match "^VERSION\\s-+\\(.*\\)\\s-*$" msg)
4225 (let ((message (match-string 1 msg)))
4226 (erc-display-message
4227 nil 'notice 'active
4228 'CTCP-VERSION ?n nick ?m message)))
4229 nil)
4230
4231(defun erc-process-away (proc away-p)
4232 ;; FIXME: This docstring is AWFUL -- Lawrence 2004-01-08
4233 "Process the user being away, or returning from an away break."
4234 (let ((sessionbuf (process-buffer proc)))
4235 (when sessionbuf
4236 (with-current-buffer sessionbuf
4237 (when erc-away-nickname
4238 (erc-log (format "erc-process-away: away-nick: %s, away-p: %s"
4239 erc-away-nickname away-p))
4240 (erc-cmd-NICK (if away-p
4241 erc-away-nickname
4242 erc-nick)))
4243 (cond
4244 (away-p
4245 (erc-with-all-buffers-of-server proc nil
4246 (setq erc-away (current-time))))
4247 (t
4248 (let ((away-time erc-away))
4249 ;; away must be set to NIL BEFORE sending anything to prevent
4250 ;; an infinite recursion
4251 (erc-with-all-buffers-of-server proc nil
4252 (setq erc-away nil))
4253 (save-excursion
4254 (set-buffer (erc-active-buffer))
4255 (when erc-public-away-p
4256 (erc-send-action
4257 (erc-default-target)
4258 (if away-time
4259 (format "is back (gone for %s)"
4260 (erc-sec-to-time
4261 (erc-time-diff
4262 (erc-emacs-time-to-erc-time away-time)
4263 (erc-current-time))))
4264 "is back")))))))))
4265 (erc-update-mode-line)))
4266
4267;;;; List of channel members handling
4268
4269(defun erc-channel-begin-receiving-names ()
4270 "Internal function.
4271
4272Used when a channel names list is about to be received. Should
4273be called with the current buffer set to the channel buffer.
4274
4275See also `erc-channel-end-receiving-names'."
4276 (setq erc-channel-new-member-names (make-hash-table :test 'equal)))
4277
4278(defun erc-channel-end-receiving-names ()
4279 "Internal function.
4280
4281Used to fix `erc-channel-users' after a channel names list has been
4282received. Should be called with the current buffer set to the
4283channel buffer.
4284
4285See also `erc-channel-begin-receiving-names'."
4286 (maphash (lambda (nick user)
4287 (if (null (gethash nick erc-channel-new-member-names))
4288 (erc-remove-channel-user nick)))
4289 erc-channel-users)
4290 (setq erc-channel-new-member-names nil))
4291
4292(defun erc-channel-receive-names (names-string)
4293 "This function is for internal use only.
4294
4295Update `erc-channel-users' according to NAMES-STRING.
4296NAMES-STRING is a string listing some of the names on the
4297channel."
4298 (let (names name op voice)
4299 ;; We need to delete "" because in XEmacs, (split-string "a ")
4300 ;; returns ("a" "").
4301 (setq names (delete "" (split-string names-string)))
4302 (let ((erc-channel-members-changed-hook nil))
4303 (dolist (item names)
4304 (cond ((string-match "^@\\(.*\\)$" item)
4305 (setq name (match-string 1 item)
4306 op 'on
4307 voice 'off))
4308 ((string-match "^+\\(.*\\)$" item)
4309 (setq name (match-string 1 item)
4310 op 'off
4311 voice 'on))
4312 (t (setq name item
4313 op 'off
4314 voice 'off)))
4315 (puthash (erc-downcase name) t
4316 erc-channel-new-member-names)
4317 (erc-update-current-channel-member
4318 name name t op voice)))
4319 (run-hooks 'erc-channel-members-changed-hook)))
4320
4321(defcustom erc-channel-members-changed-hook nil
4322 "*This hook is called every time the variable `channel-members' changes.
4323The buffer where the change happened is current while this hook is called."
4324 :group 'erc-hooks
4325 :type 'hook)
4326
4327(defun erc-update-user-nick (nick &optional new-nick
4328 host login full-name info)
4329 "Updates the stored user information for the user with nickname
4330NICK.
4331
4332See also: `erc-update-user'"
4333 (erc-update-user (erc-get-server-user nick) new-nick
4334 host login full-name info))
4335
4336(defun erc-update-user (user &optional new-nick
4337 host login full-name info)
4338 "Update user info for USER. USER must be an erc-server-user
4339struct. Any of NEW-NICK, HOST, LOGIN, FULL-NAME, INFO which are
4340non-nil and not equal to the existing values for USER are used to
4341replace the stored values in USER.
4342
4343If, any only if a change is made,
4344`erc-channel-members-changed-hook' is run for each channel for
4345which USER is a member, and `t' is returned."
4346 (let (changed)
4347 (when user
4348 (when (and new-nick
4349 (not (equal (erc-server-user-nickname user)
4350 new-nick)))
4351 (setq changed t)
4352 (erc-change-user-nickname user new-nick))
4353 (when (and host
4354 (not (equal (erc-server-user-host user) host)))
4355 (setq changed t)
4356 (setf (erc-server-user-host user) host))
4357 (when (and login
4358 (not (equal (erc-server-user-login user) login)))
4359 (setq changed t)
4360 (setf (erc-server-user-login user) login))
4361 (when (and full-name
4362 (not (equal (erc-server-user-full-name user)
4363 full-name)))
4364 (setq changed t)
4365 (setf (erc-server-user-full-name user) full-name))
4366 (when (and info
4367 (not (equal (erc-server-user-info user) info)))
4368 (setq changed t)
4369 (setf (erc-server-user-info user) info))
4370 (if changed
4371 (dolist (buf (erc-server-user-buffers user))
4372 (if (buffer-live-p buf)
4373 (with-current-buffer buf
4374 (run-hooks 'erc-channel-members-changed-hook))))))
4375 changed))
4376
4377(defun erc-update-current-channel-member
4378 (nick new-nick &optional add op voice host login full-name info
4379 update-message-time)
4380 "Updates the stored user information for the user with nickname
4381NICK. `erc-update-user' is called to handle changes to nickname,
4382host, login, full-name, and info. If `op' or `voice' are
4383non-nil, they must be equal to either `on' or `off', in which
4384case the operator or voice status of USER in the current channel
4385is changed accordingly. If `update-message-time' is non-nil, the
4386last-message-time of the user in the current channel is set
4387to (current-time).
4388
4389If ADD is non-nil, the user will be added with the specified
4390information if it is not already present in the user or channel
4391lists.
4392
4393If, and only if, changes are made, or the user is added,
4394`erc-channel-members-updated-hook' is run, and `t' is returned.
4395
4396See also: `erc-update-user' and `erc-update-channel-member'."
4397 (let* (changed user-changed
4398 (channel-data (erc-get-channel-user nick))
4399 (cuser (if channel-data (cdr channel-data)))
4400 (user (if channel-data (car channel-data)
4401 (erc-get-server-user nick))))
4402 (if cuser
4403 (progn
4404 (erc-log (format "update-member: user = %S, cuser = %S" user cuser))
4405 (when (and op
4406 (not (eq (erc-channel-user-op cuser) op)))
4407 (setq changed t)
4408 (setf (erc-channel-user-op cuser)
4409 (cond ((eq op 'on) t)
4410 ((eq op 'off) nil)
4411 (t op))))
4412 (when (and voice
4413 (not (eq (erc-channel-user-voice cuser) voice)))
4414 (setq changed t)
4415 (setf (erc-channel-user-voice cuser)
4416 (cond ((eq voice 'on) t)
4417 ((eq voice 'off) nil)
4418 (t voice))))
4419 (when update-message-time
4420 (setf (erc-channel-user-last-message-time cuser) (current-time)))
4421 (setq user-changed
4422 (erc-update-user user new-nick
4423 host login full-name info)))
4424 (when add
4425 (if (null user)
4426 (progn
4427 (setq user (make-erc-server-user
4428 :nickname nick
4429 :host host
4430 :full-name full-name
4431 :login login
4432 :info info
4433 :buffers (list (current-buffer))))
4434 (erc-add-server-user nick user))
4435 (setf (erc-server-user-buffers user)
4436 (cons (current-buffer)
4437 (erc-server-user-buffers user))))
4438 (setq cuser (make-erc-channel-user
4439 :op (cond ((eq op 'on) t)
4440 ((eq op 'off) nil)
4441 (t op))
4442 :voice (cond ((eq voice 'on) t)
4443 ((eq voice 'off) nil)
4444 (t voice))
4445 :last-message-time
4446 (if update-message-time (current-time))))
4447 (puthash (erc-downcase nick) (cons user cuser)
4448 erc-channel-users)
4449 (setq changed t)))
4450 (when (and changed (null user-changed))
4451 (run-hooks 'erc-channel-members-changed-hook))
4452 (or changed user-changed add)))
4453
4454(defun erc-update-channel-member (channel nick new-nick
4455 &optional add op voice host login
4456 full-name info update-message-time)
4457 "Updates user and channel information for the user with
4458nickname NICK in channel CHANNEL.
4459
4460See also: `erc-update-current-channel-member'"
4461 (erc-with-buffer
4462 (channel)
4463 (erc-update-current-channel-member nick new-nick add op voice host
4464 login full-name info
4465 update-message-time)))
4466
4467(defun erc-remove-current-channel-member (nick)
4468 "Remove NICK from current channel membership list. Runs
4469`erc-channel-members-changed-hook'."
4470 (let ((channel-data (erc-get-channel-user nick)))
4471 (when channel-data
4472 (erc-remove-channel-user nick)
4473 (run-hooks 'erc-channel-members-changed-hook))))
4474
4475(defun erc-remove-channel-member (channel nick)
4476 "Remove NICK from CHANNEL's membership list.
4477
4478See also `erc-remove-current-channel-member'."
4479 (erc-with-buffer
4480 (channel)
4481 (erc-remove-current-channel-member nick)))
4482
4483(defun erc-update-channel-topic (channel topic &optional modify)
4484 "Find a buffer for CHANNEL and set the TOPIC for it.
4485
4486If optional MODIFY is 'append or 'prepend, then append or prepend the
4487TOPIC string to the current topic."
4488 (erc-with-buffer (channel)
4489 (cond ((eq modify 'append)
4490 (setq erc-channel-topic (concat erc-channel-topic topic)))
4491 ((eq modify 'prepend)
4492 (setq erc-channel-topic (concat topic erc-channel-topic)))
4493 (t (setq erc-channel-topic topic)))
4494 (erc-update-mode-line-buffer (current-buffer))))
4495
4496(defun erc-set-modes (tgt mode-string)
4497 "Set the modes for the TGT provided as MODE-STRING."
4498 (let* ((modes (erc-parse-modes mode-string))
4499 (add-modes (nth 0 modes))
4500 (remove-modes (nth 1 modes))
4501 ;; list of triples: (mode-char 'on/'off argument)
4502 (arg-modes (nth 2 modes)))
4503 (cond ((erc-channel-p tgt); channel modes
4504 (let ((buf (and (boundp 'erc-server-process) erc-server-process
4505 (erc-get-buffer tgt erc-server-process))))
4506 (when buf
4507 (with-current-buffer buf
4508 (setq erc-channel-modes add-modes)
4509 (setq erc-channel-user-limit nil)
4510 (setq erc-channel-key nil)
4511 (while arg-modes
4512 (let ((mode (nth 0 (car arg-modes)))
4513 (onoff (nth 1 (car arg-modes)))
4514 (arg (nth 2 (car arg-modes))))
4515 (cond ((string-match "^[Ll]" mode)
4516 (erc-update-channel-limit tgt onoff arg))
4517 ((string-match "^[Kk]" mode)
4518 (erc-update-channel-key tgt onoff arg))
4519 (t nil)))
4520 (setq arg-modes (cdr arg-modes)))
4521 (erc-update-mode-line-buffer buf)))))
4522 ;; we do not keep our nick's modes yet
4523 ;;(t (setq erc-user-modes add-modes))
4524 )
4525 ))
4526
4527(defun erc-sort-strings (list-of-strings)
4528 "Sort LIST-OF-STRINGS in lexicographic order.
4529
4530Side-effect free."
4531 (sort (copy-sequence list-of-strings) 'string<))
4532
4533(defun erc-parse-modes (mode-string)
4534 "Parse MODE-STRING into a list.
4535
4536Returns a list of three elements:
4537
4538 (ADD-MODES REMOVE-MODES ARG-MODES).
4539
4540The add-modes and remove-modes are lists of single-character strings
4541for modes without parameters to add and remove respectively. The
4542arg-modes is a list of triples of the form:
4543
4544 (MODE-CHAR ON/OFF ARGUMENT)."
4545 (if (string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*$\\|$\\)" mode-string)
4546 (let ((chars (mapcar 'char-to-string (match-string 1 mode-string)))
4547 ;; arguments in channel modes
4548 (args-str (match-string 2 mode-string))
4549 (args nil)
4550 (add-modes nil)
4551 (remove-modes nil)
4552 (arg-modes nil); list of triples: (mode-char 'on/'off argument)
4553 (add-p t))
4554 ;; make the argument list
4555 (while (string-match "^\\s-*\\(\\S-+\\)\\(\\s-+.*$\\|$\\)" args-str)
4556 (setq args (cons (match-string 1 args-str) args))
4557 (setq args-str (match-string 2 args-str)))
4558 (setq args (nreverse args))
4559 ;; collect what modes changed, and match them with arguments
4560 (while chars
4561 (cond ((string= (car chars) "+") (setq add-p t))
4562 ((string= (car chars) "-") (setq add-p nil))
4563 ((string-match "^[ovbOVB]" (car chars))
4564 (setq arg-modes (cons (list (car chars)
4565 (if add-p 'on 'off)
4566 (if args (car args) nil))
4567 arg-modes))
4568 (if args (setq args (cdr args))))
4569 ((string-match "^[LlKk]" (car chars))
4570 (setq arg-modes (cons (list (car chars)
4571 (if add-p 'on 'off)
4572 (if (and add-p args)
4573 (car args) nil))
4574 arg-modes))
4575 (if (and add-p args) (setq args (cdr args))))
4576 (add-p (setq add-modes (cons (car chars) add-modes)))
4577 (t (setq remove-modes (cons (car chars) remove-modes))))
4578 (setq chars (cdr chars)))
4579 (setq add-modes (nreverse add-modes))
4580 (setq remove-modes (nreverse remove-modes))
4581 (setq arg-modes (nreverse arg-modes))
4582 (list add-modes remove-modes arg-modes))
4583 nil))
4584
4585(defun erc-update-modes (tgt mode-string &optional nick host login)
4586 "Update the mode information for TGT, provided as MODE-STRING.
4587Optional arguments: NICK, HOST and LOGIN - the attributes of the
4588person who changed the modes."
4589 (let* ((modes (erc-parse-modes mode-string))
4590 (add-modes (nth 0 modes))
4591 (remove-modes (nth 1 modes))
4592 ;; list of triples: (mode-char 'on/'off argument)
4593 (arg-modes (nth 2 modes)))
4594 ;; now parse the modes changes and do the updates
4595 (cond ((erc-channel-p tgt); channel modes
4596 (let ((buf (and (boundp 'erc-server-process) erc-server-process
4597 (erc-get-buffer tgt erc-server-process))))
4598 (when buf
4599 ;; FIXME! This used to have an original buffer
4600 ;; variable, but it never switched back to the original
4601 ;; buffer. Is this wanted behavior?
4602 (set-buffer buf)
4603 (if (not (boundp 'erc-channel-modes))
4604 (setq erc-channel-modes nil))
4605 (while remove-modes
4606 (setq erc-channel-modes (delete (car remove-modes)
4607 erc-channel-modes)
4608 remove-modes (cdr remove-modes)))
4609 (while add-modes
4610 (setq erc-channel-modes (cons (car add-modes)
4611 erc-channel-modes)
4612 add-modes (cdr add-modes)))
4613 (setq erc-channel-modes (erc-sort-strings erc-channel-modes))
4614 (while arg-modes
4615 (let ((mode (nth 0 (car arg-modes)))
4616 (onoff (nth 1 (car arg-modes)))
4617 (arg (nth 2 (car arg-modes))))
4618 (cond ((string-match "^[oO]" mode)
4619 (erc-update-channel-member tgt arg arg nil onoff))
4620 ((string-match "^[Vv]" mode)
4621 (erc-update-channel-member tgt arg arg nil nil
4622 onoff))
4623 ((string-match "^[Ll]" mode)
4624 (erc-update-channel-limit tgt onoff arg))
4625 ((string-match "^[Kk]" mode)
4626 (erc-update-channel-key tgt onoff arg))
4627 (t nil)); only ops are tracked now
4628 (setq arg-modes (cdr arg-modes))))
4629 (erc-update-mode-line buf))))
4630 ;; nick modes - ignored at this point
4631 (t nil))))
4632
4633(defun erc-update-channel-limit (channel onoff n)
4634 ;; FIXME: what does ONOFF actually do? -- Lawrence 2004-01-08
4635 "Update CHANNEL's user limit to N."
4636 (if (or (not (eq onoff 'on))
4637 (and (stringp n) (string-match "^[0-9]+$" n)))
4638 (erc-with-buffer
4639 (channel)
4640 (cond ((eq onoff 'on) (setq erc-channel-user-limit (string-to-number n)))
4641 (t (setq erc-channel-user-limit nil))))))
4642
4643(defun erc-update-channel-key (channel onoff key)
4644 "Update CHANNEL's key to KEY if ONOFF is 'on or to nil if it's 'off."
4645 (erc-with-buffer
4646 (channel)
4647 (cond ((eq onoff 'on) (setq erc-channel-key key))
4648 (t (setq erc-channel-key nil)))))
4649
4650(defun erc-handle-user-status-change (type nlh &optional l)
4651 "Handle changes in any user's status.
4652
4653So far, only nick change is handled.
4654
4655Generally, the TYPE argument is a symbol describing the change type, NLH is
4656a list containing the original nickname, login name and hostname for the user,
4657and L is a list containing additional TYPE-specific arguments.
4658
4659So far the following TYPE/L pairs are supported:
4660
4661 Event TYPE L
4662
4663 nickname change 'nick (NEW-NICK)"
4664 (erc-log (format "user-change: type: %S nlh: %S l: %S" type nlh l))
4665 (cond
4666 ;; nickname change
4667 ((equal type 'nick)
4668 t)
4669 (t
4670 nil)))
4671
4672(defun erc-highlight-notice (s)
4673 "Highlight notice message S and return it.
4674See also variable `erc-notice-highlight-type'"
4675 (cond
4676 ((eq erc-notice-highlight-type 'prefix)
4677 (erc-put-text-property 0 (length erc-notice-prefix)
4678 'face 'erc-notice-face s)
4679 s)
4680 ((eq erc-notice-highlight-type 'all)
4681 (erc-put-text-property 0 (length s) 'face 'erc-notice-face s)
4682 s)
4683 (t s)))
4684
4685(defun erc-make-notice (message)
4686 "Notify the user of MESSAGE."
4687 (when erc-minibuffer-notice
4688 (message "%s" message))
4689 (erc-highlight-notice (concat erc-notice-prefix message)))
4690
4691(defun erc-highlight-error (s)
4692 "Highlight error message S and return it."
4693 (erc-put-text-property 0 (length s) 'face 'erc-error-face s)
4694 s)
4695
4696(defun erc-put-text-property (start end property value &optional object)
4697 "Set text-property for an object (usually a string).
4698START and END define the characters covered.
4699PROPERTY is the text-property set, usually the symbol `face'.
4700VALUE is the value for the text-property, usually a face symbol such as
4701the face `bold' or `erc-pal-face'.
4702OBJECT is a string which will be modified and returned.
4703OBJECT is modified without being copied first.
4704
4705You can redefine or `defadvice' this function in order to add
4706EmacsSpeak support."
4707 (put-text-property start end property value object))
4708
4709(defun erc-list (thing)
4710 "Return THING if THING is a list, or a list with THING as its element."
4711 (if (listp thing)
4712 thing
4713 (list thing)))
4714
4715(defun erc-parse-user (string)
4716 "Parse STRING as a user specification (nick!login@host).
4717
4718Return a list of the three separate tokens."
4719 (cond
4720 ((string-match "^\\([^!]*\\)!\\([^@]*\\)@\\(.*\\)$" string)
4721 (list (match-string 1 string)
4722 (match-string 2 string)
4723 (match-string 3 string)))
4724 ;; Some bogus bouncers send Nick!(null), try to live with that.
4725 ((string-match "^\\([^!]*\\)!\\(.*\\)$" string)
4726 (list (match-string 1 string)
4727 ""
4728 (match-string 2 string)))
4729 (t
4730 (list string "" ""))))
4731
4732(defun erc-extract-nick (string)
4733 "Return the nick corresponding to a user specification STRING.
4734
4735See also `erc-parse-user'."
4736 (car (erc-parse-user string)))
4737
4738(defun erc-put-text-properties (start end properties
4739 &optional object value-list)
4740 "Set text-properties for OBJECT.
4741
4742START and END describe positions in OBJECT.
4743If VALUE-LIST is nil, set each property in PROPERTIES to t, else set
4744each property to the corresponding value in VALUE-LIST."
4745 (unless value-list
4746 (setq value-list (mapcar (lambda (x)
4747 t)
4748 properties)))
4749 (mapcar* (lambda (prop value)
4750 (erc-put-text-property start end prop value object))
4751 properties value-list))
4752
4753;;; Input area handling:
4754
4755(defun erc-beg-of-input-line ()
4756 "Return the value of `point' at the beginning of the input line.
4757
4758Specifically, return the position of `erc-insert-marker'."
4759 (or (and (boundp 'erc-insert-marker)
4760 (markerp erc-insert-marker))
4761 (error "erc-insert-marker has no value, please report a bug"))
4762 (marker-position erc-insert-marker))
4763
4764(defun erc-end-of-input-line ()
4765 "Return the value of `point' at the end of the input line."
4766 (point-max))
4767
4768(defun erc-send-current-line ()
4769 "Parse current line and send it to IRC."
4770 (interactive)
4771 (save-restriction
4772 (widen)
4773 (cond
4774 ((< (point) (erc-beg-of-input-line))
4775 (message "Point is not in the input area")
4776 (beep))
4777 ((not (erc-server-buffer-live-p))
4778 (message "ERC: No process running")
4779 (beep))
4780 (t
4781 (erc-set-active-buffer (current-buffer))
4782 (let ((inhibit-read-only t)
4783 (str (erc-user-input))
4784 (old-buf (current-buffer)))
4785
4786 ;; Kill the input and the prompt
4787 (delete-region (erc-beg-of-input-line)
4788 (erc-end-of-input-line))
4789
4790 (unwind-protect
4791 (erc-send-input str)
4792 ;; Fix the buffer if the command didn't kill it
4793 (when (buffer-live-p old-buf)
4794 (with-current-buffer old-buf
4795 (save-restriction
4796 (widen)
4797 (goto-char (point-max))
4798 (set-marker (process-mark erc-server-process) (point))
4799 (set-marker erc-insert-marker (point))
4800 (let ((buffer-modified (buffer-modified-p)))
4801 (erc-display-prompt)
4802 (set-buffer-modified-p buffer-modified))))))
4803
4804 ;; Only when last hook has been run...
4805 (run-hook-with-args 'erc-send-completed-hook str))))))
4806
4807(defun erc-user-input ()
4808 "Return the input of the user in the current buffer."
4809 (buffer-substring
4810 erc-input-marker
4811 (erc-end-of-input-line)))
4812
4813(defun erc-send-input (input)
4814 "Treat INPUT as typed in by the user. It is assumed that the input
4815and the prompt is already deleted.
4816This returns non-nil only iff we actually send anything."
4817 ;; Handle different kinds of inputs
4818 (cond
4819 ;; Ignore empty input
4820 ((if erc-send-whitespace-lines
4821 (string= input "")
4822 (string-match "\\`[ \t\r\f\n]*\\'" input))
4823 (when erc-warn-about-blank-lines
4824 (message "Blank line - ignoring...")
4825 (beep))
4826 nil)
4827 (t
4828 (let ((str input)
4829 (erc-insert-this t))
4830 (setq erc-send-this t)
4831 (run-hook-with-args 'erc-send-pre-hook input)
4832 (when erc-send-this
4833 (if (or (string-match "\n" str)
4834 (not (char-equal (aref str 0) ?/)))
4835 (mapc
4836 (lambda (line)
4837 (mapc
4838 (lambda (line)
4839 ;; Insert what has to be inserted for this.
4840 (erc-display-msg line)
4841 (erc-process-input-line (concat line "\n")
4842 (null erc-flood-protect) t))
4843 (erc-split-line line)))
4844 (split-string str "\n"))
4845 ;; Insert the prompt along with the command.
4846 (erc-display-command str)
4847 (erc-process-input-line (concat str "\n") t nil))
4848 t)))))
4849
4850(defun erc-display-command (line)
4851 (when erc-insert-this
4852 (let ((insert-position (point)))
4853 (unless erc-hide-prompt
4854 (erc-display-prompt nil nil (erc-command-indicator)
4855 (and (erc-command-indicator)
4856 'erc-command-indicator-face)))
4857 (let ((beg (point)))
4858 (insert line)
4859 (erc-put-text-property beg (point)
4860 'face 'erc-command-indicator-face)
4861 (insert "\n"))
4862 (set-marker (process-mark erc-server-process) (point))
4863 (set-marker erc-insert-marker (point))
4864 (save-excursion
4865 (save-restriction
4866 (narrow-to-region insert-position (point))
4867 (run-hooks 'erc-send-modify-hook)
4868 (run-hooks 'erc-send-post-hook))))))
4869
4870(defun erc-display-msg (line)
4871 "Display LINE as a message of the user to the current target at the
4872current position."
4873 (when erc-insert-this
4874 (let ((insert-position (point)))
4875 (insert (erc-format-my-nick))
4876 (let ((beg (point)))
4877 (insert line)
4878 (erc-put-text-property beg (point)
4879 'face 'erc-input-face))
4880 (insert "\n")
4881 (set-marker (process-mark erc-server-process) (point))
4882 (set-marker erc-insert-marker (point))
4883 (save-excursion
4884 (save-restriction
4885 (narrow-to-region insert-position (point))
4886 (run-hooks 'erc-send-modify-hook)
4887 (run-hooks 'erc-send-post-hook))))))
4888
4889(defun erc-command-symbol (command)
4890 "Return the erc command symbol for COMMAND if it exists and is bound."
4891 (let ((cmd (intern-soft (format "erc-cmd-%s" (upcase command)))))
4892 (when (fboundp cmd) cmd)))
4893
4894(defun erc-extract-command-from-line (line)
4895 "Extract command and args from the input LINE.
4896If no command was given, return nil. If command matches, return a
4897list of the form: (command args) where both elements are strings."
4898 (when (string-match "^/\\([A-Za-z]+\\)\\(\\s-+.*\\|\\s-*\\)$" line)
4899 (let* ((cmd (erc-command-symbol (match-string 1 line)))
4900 ;; note: return is nil, we apply this simply for side effects
4901 (canon-defun (while (and cmd (symbolp (symbol-function cmd)))
4902 (setq cmd (symbol-function cmd))))
4903 (cmd-fun (or cmd #'erc-cmd-default))
4904 (arg (if cmd
4905 (if (get cmd-fun 'do-not-parse-args)
4906 (format "%s" (match-string 2 line))
4907 (delete "" (split-string (erc-trim-string
4908 (match-string 2 line)) " ")))
4909 line)))
4910 (list cmd-fun arg))))
4911
4912(defun erc-split-multiline-safe (string)
4913 "Split STRING, containing multiple lines and return them in a list.
4914Do it only for STRING as the complete input, do not carry unfinished
4915strings over to the next call."
4916 (let ((l ())
4917 (i0 0)
4918 (doit t))
4919 (while doit
4920 (let ((i (string-match "\r?\n" string i0))
4921 (s (substring string i0)))
4922 (cond (i (setq l (cons (substring string i0 i) l))
4923 (setq i0 (match-end 0)))
4924 ((> (length s) 0)
4925 (setq l (cons s l))(setq doit nil))
4926 (t (setq doit nil)))))
4927 (nreverse l)))
4928
4929;; nick handling
4930
4931(defun erc-set-current-nick (nick)
4932 "Set the current nickname to NICK."
4933 (with-current-buffer (or (erc-server-buffer)
4934 (current-buffer))
4935 (setq erc-server-current-nick nick)))
4936
4937(defun erc-current-nick ()
4938 "Return the current nickname."
4939 (with-current-buffer (if (buffer-live-p (erc-server-buffer))
4940 (erc-server-buffer)
4941 (current-buffer))
4942 erc-server-current-nick))
4943
4944(defun erc-current-nick-p (nick)
4945 "Return non-nil if NICK is the current nickname."
4946 (erc-nick-equal-p nick (erc-current-nick)))
4947
4948(defun erc-nick-equal-p (nick1 nick2)
4949 "Return non-nil if NICK1 and NICK2 are the same.
4950
4951This matches strings according to the IRC protocol's case convention.
4952
4953See also `erc-downcase'."
4954 (string= (erc-downcase nick1)
4955 (erc-downcase nick2)))
4956
4957;; default target handling
4958
4959(defun erc-default-target ()
4960 "Return the current default target (as a character string) or nil if none."
4961 (let ((tgt (car erc-default-recipients)))
4962 (cond
4963 ((not tgt) nil)
4964 ((listp tgt) (cdr tgt))
4965 (t tgt))))
4966
4967(defun erc-add-default-channel (channel)
4968 "Add CHANNEL to the default channel list."
4969
4970 (let ((d1 (car erc-default-recipients))
4971 (d2 (cdr erc-default-recipients))
4972 (chl (downcase channel)))
4973 (setq erc-default-recipients
4974 (cons chl erc-default-recipients))))
4975
4976(defun erc-delete-default-channel (channel &optional buffer)
4977 "Delete CHANNEL from the default channel list."
4978 (let ((ob (current-buffer)))
4979 (with-current-buffer (if (and buffer
4980 (bufferp buffer))
4981 buffer
4982 (current-buffer))
4983 (setq erc-default-recipients (delete (downcase channel)
4984 erc-default-recipients)))))
4985
4986(defun erc-add-query (nickname)
4987 "Add QUERY'd NICKNAME to the default channel list.
4988
4989The previous default target of QUERY type gets removed"
4990 (let ((d1 (car erc-default-recipients))
4991 (d2 (cdr erc-default-recipients))
4992 (qt (cons 'QUERY (downcase nickname))))
4993 (if (and (listp d1)
4994 (eq (car d1) 'QUERY))
4995 (setq erc-default-recipients (cons qt d2))
4996 (setq erc-default-recipients (cons qt erc-default-recipients)))))
4997
4998(defun erc-delete-query ()
4999 "Delete the topmost target if it is a QUERY."
5000
5001 (let ((d1 (car erc-default-recipients))
5002 (d2 (cdr erc-default-recipients)))
5003 (if (and (listp d1)
5004 (eq (car d1) 'QUERY))
5005 (setq erc-default-recipients d2)
5006 (error "Current target is not a QUERY"))))
5007
5008(defun erc-ignored-user-p (spec)
5009 "Return non-nil if SPEC matches something in `erc-ignore-list'.
5010
5011Takes a full SPEC of a user in the form \"nick!login@host\", and
5012matches against all the regexp's in `erc-ignore-list'. If any
5013match, returns that regexp."
5014 (dolist (ignored (with-current-buffer (erc-server-buffer) erc-ignore-list))
5015 (if (string-match ignored spec)
5016 ;; We have `require'd cl, so we can return from the block named nil
5017 (return ignored))))
5018
5019(defun erc-ignored-reply-p (msg tgt proc)
5020 ;; FIXME: this docstring needs fixing -- Lawrence 2004-01-08
5021 "Return non-nil if MSG matches something in `erc-ignore-reply-list'.
5022
5023Takes a message MSG to a channel and returns non-nil if the addressed
5024user matches any regexp in `erc-ignore-reply-list'."
5025 (let ((target-nick (erc-message-target msg)))
5026 (if (not target-nick)
5027 nil
5028 (erc-with-buffer (tgt proc)
5029 (let ((user (erc-get-server-user target-nick)))
5030 (when user
5031 (erc-list-match erc-ignore-reply-list
5032 (erc-user-spec user))))))))
5033
5034(defun erc-message-target (msg)
5035 "Return the addressed target in MSG.
5036
5037The addressed target is the string before the first colon in MSG."
5038 (if (string-match "^\\([^: ]*\\):" msg)
5039 (match-string 1 msg)
5040 nil))
5041
5042(defun erc-user-spec (user)
5043 "Create a nick!user@host spec from a user struct."
5044 (let ((nick (erc-server-user-nickname user))
5045 (host (erc-server-user-host user))
5046 (login (erc-server-user-login user)))
5047 (concat (if nick
5048 nick
5049 "")
5050 "!"
5051 (if login
5052 login
5053 "")
5054 "@"
5055 (if host
5056 host
5057 ""))))
5058
5059(defun erc-list-match (lst str)
5060 "Return non-nil if any regexp in LST matches STR."
5061 (memq nil (mapcar (lambda (regexp)
5062 (not (string-match regexp str)))
5063 lst)))
5064
5065;; other "toggles"
5066
5067(defun erc-toggle-ctcp-autoresponse (&optional arg)
5068 "Toggle automatic CTCP replies (like VERSION and PING).
5069
5070If ARG is positive, turns CTCP replies on.
5071
5072If ARG is non-nil and not positive, turns CTCP replies off."
5073 (interactive "P")
5074 (cond ((and (numberp arg) (> arg 0))
5075 (setq erc-disable-ctcp-replies t))
5076 (arg (setq erc-disable-ctcp-replies nil))
5077 (t (setq erc-disable-ctcp-replies (not erc-disable-ctcp-replies))))
5078 (message "ERC CTCP replies are %s" (if erc-disable-ctcp-replies "OFF" "ON")))
5079
5080(defun erc-toggle-flood-control (&optional arg)
5081 "Toggle use of flood control on sent messages.
5082
5083If ARG is non-nil, use flood control.
5084If ARG is nil, do not use flood control.
5085
5086See `erc-server-flood-margin' for an explanation of the available
5087flood control parameters."
5088 (interactive "P")
5089 (setq erc-flood-protect arg)
5090 (message "ERC flood control is %s"
5091 (cond (erc-flood-protect "ON")
5092 (t "OFF"))))
5093
5094;; Some useful channel and nick commands for fast key bindings
5095
5096(defun erc-invite-only-mode (&optional arg)
5097 "Turn on the invite only mode (+i) for the current channel.
5098
5099If ARG is non-nil, turn this mode off (-i).
5100
5101This command is sent even if excess flood is detected."
5102 (interactive "P")
5103 (erc-set-active-buffer (current-buffer))
5104 (let ((tgt (erc-default-target))
5105 (erc-force-send t))
5106 (cond ((or (not tgt) (not (erc-channel-p tgt)))
5107 (erc-display-message nil 'error (current-buffer) 'no-target))
5108 (arg (erc-load-irc-script-lines (list (concat "/mode " tgt " -i"))
5109 t))
5110 (t (erc-load-irc-script-lines (list (concat "/mode " tgt " +i"))
5111 t)))))
5112
5113(defun erc-get-channel-mode-from-keypress (key)
5114 "Read a key sequence and call the corresponding channel mode function.
5115After doing C-c C-o type in a channel mode letter.
5116
5117C-g means quit.
5118RET let's you type more than one mode at a time.
5119If \"l\" is pressed, `erc-set-channel-limit' gets called.
5120If \"k\" is pressed, `erc-set-channel-key' gets called.
5121Anything else will be sent to `erc-toggle-channel-mode'."
5122 (interactive "kChannel mode (RET to set more than one): ")
5123 (when (featurep 'xemacs)
5124 (setq key (char-to-string (event-to-character (aref key 0)))))
5125 (cond ((equal key "\C-g")
5126 (keyboard-quit))
5127 ((equal key "\C-m")
5128 (erc-insert-mode-command))
5129 ((equal key "l")
5130 (call-interactively 'erc-set-channel-limit))
5131 ((equal key "k")
5132 (call-interactively 'erc-set-channel-key))
5133 (t (erc-toggle-channel-mode key))))
5134
5135(defun erc-toggle-channel-mode (mode &optional channel)
5136 "Toggle channel MODE.
5137
5138If CHANNEL is non-nil, toggle MODE for that channel, otherwise use
5139`erc-default-target'."
5140 (interactive "P")
5141 (erc-set-active-buffer (current-buffer))
5142 (let ((tgt (or channel (erc-default-target)))
5143 (erc-force-send t))
5144 (cond ((or (null tgt) (null (erc-channel-p tgt)))
5145 (erc-display-message nil 'error 'active 'no-target))
5146 ((member mode erc-channel-modes)
5147 (erc-log (format "%s: Toggle mode %s OFF" tgt mode))
5148 (message "Toggle channel mode %s OFF" mode)
5149 (erc-server-send (format "MODE %s -%s" tgt mode)))
5150 (t (erc-log (format "%s: Toggle channel mode %s ON" tgt mode))
5151 (message "Toggle channel mode %s ON" mode)
5152 (erc-server-send (format "MODE %s +%s" tgt mode))))))
5153
5154(defun erc-insert-mode-command ()
5155 "Insert the line \"/mode <current target> \" at `point'."
5156 (interactive)
5157 (let ((tgt (erc-default-target)))
5158 (if tgt (insert (concat "/mode " tgt " "))
5159 (erc-display-message nil 'error (current-buffer) 'no-target))))
5160
5161(defun erc-channel-names ()
5162 "Run \"/names #channel\" in the current channel."
5163 (interactive)
5164 (erc-set-active-buffer (current-buffer))
5165 (let ((tgt (erc-default-target)))
5166 (if tgt (erc-load-irc-script-lines (list (concat "/names " tgt)))
5167 (erc-display-message nil 'error (current-buffer) 'no-target))))
5168
5169(defun erc-remove-text-properties-region (start end &optional object)
5170 "Clears the region (START,END) in OBJECT from all colors, etc."
5171 (interactive "r")
5172 (save-excursion
5173 (let ((inhibit-read-only t))
5174 (set-text-properties start end nil object))))
5175
5176;; script execution and startup
5177
5178(defun erc-find-file (file &optional path)
5179 "Search for a FILE in the filesystem.
5180First the `default-directory' is searched for FILE, then any directories
5181specified in the list PATH.
5182
5183If FILE is found, return the path to it."
5184 (let ((filepath file))
5185 (if (file-readable-p filepath) filepath
5186 (progn
5187 (while (and path
5188 (progn (setq filepath (expand-file-name file (car path)))
5189 (not (file-readable-p filepath))))
5190 (setq path (cdr path)))
5191 (if path filepath nil)))))
5192
5193(defun erc-select-startup-file ()
5194 "Select an ERC startup file.
5195See also `erc-startup-file-list'."
5196 (let ((l erc-startup-file-list)
5197 (f nil))
5198 (while (and (not f) l)
5199 (if (file-readable-p (car l))
5200 (setq f (car l)))
5201 (setq l (cdr l)))
5202 f))
5203
5204(defun erc-find-script-file (file)
5205 "Search for FILE in `default-directory', and any in `erc-script-path'."
5206 (erc-find-file file erc-script-path))
5207
5208(defun erc-load-script (file)
5209 "Load a script from FILE.
5210
5211FILE must be the full name, it is not searched in the
5212`erc-script-path'. If the filename ends with `.el', then load it
5213as a emacs-lisp program. Otherwise, treat it as a regular IRC
5214script"
5215 (erc-log (concat "erc-load-script: " file))
5216 (cond
5217 ((string-match "\\.el$" file)
5218 (load file))
5219 (t
5220 (erc-load-irc-script file))))
5221
5222(defun erc-process-script-line (line &optional args)
5223 "Process an IRC script LINE.
5224
5225Does script-specific substitutions (script arguments, current nick,
5226server, etc.) in LINE and returns it.
5227
5228Substitutions are: %C and %c = current target (channel or nick),
5229%S %s = current server, %N %n = my current nick, and %x is x verbatim,
5230where x is any other character;
5231$* = the entire argument string, $1 = the first argument, $2 = the second,
5232end so on."
5233 (if (not args) (setq args ""))
5234 (let* ((arg-esc-regexp "\\(\\$\\(\\*\\|[1-9][0-9]*\\)\\)\\([^0-9]\\|$\\)")
5235 (percent-regexp "\\(%.\\)")
5236 (esc-regexp (concat arg-esc-regexp "\\|" percent-regexp))
5237 (tgt (erc-default-target))
5238 (server (and (boundp 'erc-session-server) erc-session-server))
5239 (nick (erc-current-nick))
5240 (res "")
5241 (tmp nil)
5242 (arg-list nil)
5243 (arg-num 0))
5244 (if (not tgt) (setq tgt ""))
5245 (if (not server) (setq server ""))
5246 (if (not nick) (setq nick ""))
5247 ;; First, compute the argument list
5248 (setq tmp args)
5249 (while (string-match "^\\s-*\\(\\S-+\\)\\(\\s-+.*$\\|$\\)" tmp)
5250 (setq arg-list (cons (match-string 1 tmp) arg-list))
5251 (setq tmp (match-string 2 tmp)))
5252 (setq arg-list (nreverse arg-list))
5253 (setq arg-num (length arg-list))
5254 ;; now do the substitution
5255 (setq tmp (string-match esc-regexp line))
5256 (while tmp
5257 ;;(message "beginning of while: tmp=%S" tmp)
5258 (let* ((hd (substring line 0 tmp))
5259 (esc "")
5260 (subst "")
5261 (tail (substring line tmp)))
5262 (cond ((string-match (concat "^" arg-esc-regexp) tail)
5263 (setq esc (match-string 1 tail))
5264 (setq tail (substring tail (match-end 1))))
5265 ((string-match (concat "^" percent-regexp) tail)
5266 (setq esc (match-string 1 tail))
5267 (setq tail (substring tail (match-end 1)))))
5268 ;;(message "hd=%S, esc=%S, tail=%S, arg-num=%S" hd esc tail arg-num)
5269 (setq res (concat res hd))
5270 (setq subst
5271 (cond ((string= esc "") "")
5272 ((string-match "^\\$\\*$" esc) args)
5273 ((string-match "^\\$\\([0-9]+\\)$" esc)
5274 (let ((n (string-to-number (match-string 1 esc))))
5275 (message "n = %S, integerp(n)=%S" n (integerp n))
5276 (if (<= n arg-num) (nth (1- n) arg-list) "")))
5277 ((string-match "^%[Cc]$" esc) tgt)
5278 ((string-match "^%[Ss]$" esc) server)
5279 ((string-match "^%[Nn]$" esc) nick)
5280 ((string-match "^%\\(.\\)$" esc) (match-string 1 esc))
5281 (t (erc-log (format "BUG in erc-process-script-line: bad escape sequence: %S\n" esc))
5282 (message "BUG IN ERC: esc=%S" esc)
5283 "")))
5284 (setq line tail)
5285 (setq tmp (string-match esc-regexp line))
5286 (setq res (concat res subst))
5287 ;;(message "end of while: line=%S, res=%S, tmp=%S" line res tmp)
5288 ))
5289 (setq res (concat res line))
5290 res))
5291
5292(defun erc-load-irc-script (file &optional force)
5293 "Load an IRC script from FILE."
5294 (erc-log (concat "erc-load-script: " file))
5295 (let ((str (with-temp-buffer
5296 (insert-file-contents file)
5297 (buffer-string))))
5298 (erc-load-irc-script-lines (erc-split-multiline-safe str) force)))
5299
5300(defun erc-load-irc-script-lines (lines &optional force noexpand)
5301 "Load IRC script LINES (a list of strings).
5302
5303If optional NOEXPAND is non-nil, do not expand script-specific
5304sequences, process the lines verbatim. Use this for multiline
5305user input."
5306 (let* ((cb (current-buffer))
5307 (pnt (point))
5308 (s "")
5309 (sp (or (erc-command-indicator) (erc-prompt)))
5310 (args (and (boundp 'erc-script-args) erc-script-args)))
5311 (if (and args (string-match "^ " args))
5312 (setq args (substring args 1)))
5313 ;; prepare the prompt string for echo
5314 (erc-put-text-property 0 (length sp)
5315 'face 'erc-command-indicator-face sp)
5316 (while lines
5317 (setq s (car lines))
5318 (erc-log (concat "erc-load-script: CMD: " s))
5319 (unless (string-match "^\\s-*$" s)
5320 (let ((line (if noexpand s (erc-process-script-line s args))))
5321 (if (and (erc-process-input-line line force)
5322 erc-script-echo)
5323 (progn
5324 (erc-put-text-property 0 (length line)
5325 'face 'erc-input-face line)
5326 (erc-display-line (concat sp line) cb)))))
5327 (setq lines (cdr lines)))))
5328
5329;; authentication
5330
5331(defun erc-login ()
5332 "Perform user authentication at the IRC server."
5333 (erc-log (format "login: nick: %s, user: %s %s %s :%s"
5334 (erc-current-nick)
5335 (user-login-name)
5336 (system-name)
5337 erc-session-server
5338 erc-session-user-full-name))
5339 (if erc-session-password
5340 (erc-server-send (format "PASS %s" erc-session-password))
5341 (message "Logging in without password"))
5342 (erc-server-send (format "NICK %s" (erc-current-nick)))
5343 (erc-server-send
5344 (format "USER %s %s %s :%s"
5345 ;; hacked - S.B.
5346 (if erc-anonymous-login erc-email-userid (user-login-name))
5347 "0" "*"
5348 erc-session-user-full-name))
5349 (erc-update-mode-line))
5350
5351;; connection properties' heuristics
5352
5353(defun erc-determine-parameters (&optional server port nick name)
5354 "Determine the connection and authentication parameters.
5355Sets the buffer local variables:
5356
5357- erc-session-server
5358- erc-session-port
5359- erc-session-full-name
5360- erc-server-current-nick"
5361 (setq erc-session-server (erc-compute-server server)
5362 erc-session-port (or port erc-default-port)
5363 erc-session-user-full-name (erc-compute-full-name name))
5364 (erc-set-current-nick (erc-compute-nick nick)))
5365
5366(defun erc-compute-server (&optional server)
5367 "Return an IRC server name.
5368
5369Tries a number of increasingly more default methods until a non-nil value is
5370found:
5371
5372- SERVER
5373- `erc-server'
5374- The value of the IRCSERVER environment variable
5375- `erc-default-server'."
5376 (or server
5377 erc-server
5378 (getenv "IRCSERVER")
5379 erc-default-server))
5380
5381(defun erc-compute-nick (&optional nick)
5382 "Return user's NICK.
5383
5384Tries a number of increasingly more default methods until a non-nil value is
5385found:
5386
5387- NICK
5388- `erc-nick'
5389- The value of the IRCNICK environment variable
5390- via the function `user-login-name'."
5391 (or nick
5392 (if (consp erc-nick) (car erc-nick) erc-nick)
5393 (getenv "IRCNICK")
5394 (user-login-name)))
5395
5396
5397(defun erc-compute-full-name (&optional full-name)
5398 "Return user's FULL-NAME.
5399
5400Tries a number of increasingly more default methods until a non-nil value is
5401found:
5402
5403- FULL-NAME
5404- `erc-user-full-name'
5405- The value of the IRCNAME environment variable
5406- via the function `user-full-name'."
5407 (or full-name
5408 erc-user-full-name
5409 (getenv "IRCNAME")
5410 (if erc-anonymous-login "unknown" nil)
5411 (user-full-name)))
5412
5413(defun erc-compute-port (&optional port)
5414 "Return a port for an IRC server.
5415
5416Tries a number of increasingly more default methods until a non-nil
5417value is found:
5418
5419- PORT
5420- \"ircd\"."
5421 (or port erc-port "ircd"))
5422
5423;; time routines
5424
5425(defun erc-string-to-emacs-time (string)
5426 "Convert the long number represented by STRING into an Emacs format.
5427Returns a list of the form (HIGH LOW), compatible with Emacs time format."
5428 (let* ((n (string-to-number (concat string ".0"))))
5429 (list (truncate (/ n 65536))
5430 (truncate (mod n 65536)))))
5431
5432(defun erc-emacs-time-to-erc-time (time)
5433 "Convert Emacs TIME to a number of seconds since the epoch."
5434 (when time
5435 (+ (* (nth 0 time) 65536.0) (nth 1 time))))
5436; (round (+ (* (nth 0 tm) 65536.0) (nth 1 tm))))
5437
5438(defun erc-current-time ()
5439 "Return the `current-time' as a number of seconds since the epoch.
5440
5441See also `erc-emacs-time-to-erc-time'."
5442 (erc-emacs-time-to-erc-time (current-time)))
5443
5444(defun erc-time-diff (t1 t2)
5445 "Return the time difference in seconds between T1 and T2."
5446 (abs (- t2 t1)))
5447
5448(defun erc-time-gt (t1 t2)
5449 "Check whether T1 > T2."
5450 (> t1 t2))
5451
5452(defun erc-sec-to-time (ns)
5453 "Convert NS to a time string HH:MM.SS."
5454 (setq ns (truncate ns))
5455 (format "%02d:%02d.%02d"
5456 (/ ns 3600)
5457 (/ (% ns 3600) 60)
5458 (% ns 60)))
5459
5460(defun erc-seconds-to-string (seconds)
5461 "Convert a number of SECONDS into an English phrase."
5462 (let (days hours minutes format-args output)
5463 (setq days (/ seconds 86400)
5464 seconds (% seconds 86400)
5465 hours (/ seconds 3600)
5466 seconds (% seconds 3600)
5467 minutes (/ seconds 60)
5468 seconds (% seconds 60)
5469 format-args (if (> days 0)
5470 `("%d days, %d hours, %d minutes, %d seconds"
5471 ,days ,hours ,minutes ,seconds)
5472 (if (> hours 0)
5473 `("%d hours, %d minutes, %d seconds"
5474 ,hours ,minutes ,seconds)
5475 (if (> minutes 0)
5476 `("%d minutes, %d seconds" ,minutes ,seconds)
5477 `("%d seconds" ,seconds))))
5478 output (apply 'format format-args))
5479 ;; Change all "1 units" to "1 unit".
5480 (while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output)
5481 (setq output (erc-replace-match-subexpression-in-string
5482 "" output (match-string 2 output) 2 (match-beginning 2))))
5483 output))
5484
5485
5486;; info
5487
5488(defconst erc-clientinfo-alist
5489 '(("ACTION" . "is used to inform about one's current activity")
5490 ("CLIENTINFO" . "gives help on CTCP commands supported by client")
5491 ("ECHO" . "echoes its arguments back")
5492 ("FINGER" . "shows user's name, location, and idle time")
5493 ("PING" . "measures delay between peers")
5494 ("TIME" . "shows client-side time")
5495 ("USERINFO" . "shows information provided by a user")
5496 ("VERSION" . "shows client type and version"))
5497 "Alist of CTCP CLIENTINFO for ERC commands.")
5498
5499(defun erc-client-info (s)
5500 "Return CTCP CLIENTINFO on command S.
5501If S is NIL or an empty string then return general CLIENTINFO"
5502 (if (or (not s) (string= s ""))
5503 (concat
5504 (apply #'concat
5505 (mapcar (lambda (e)
5506 (concat (car e) " "))
5507 erc-clientinfo-alist))
5508 ": use CLIENTINFO <COMMAND> to get more specific information")
5509 (let ((h (assoc (upcase s) erc-clientinfo-alist)))
5510 (if h
5511 (concat s " " (cdr h))
5512 (concat s ": unknown command")))))
5513
5514;; Hook functions
5515
5516(defun erc-directory-writable-p (dir)
5517 "Determine whether DIR is a writable directory.
5518If it doesn't exist, create it."
5519 (unless (file-attributes dir) (make-directory dir))
5520 (or (file-accessible-directory-p dir) (error "Cannot access %s" dir)))
5521
5522(defun erc-kill-query-buffers (process)
5523 "Kill all buffers of PROCESS."
5524 ;; here, we only want to match the channel buffers, to avoid
5525 ;; "selecting killed buffers" b0rkage.
5526 (erc-with-all-buffers-of-server process
5527 (lambda ()
5528 (not (erc-server-buffer-p)))
5529 (kill-buffer (current-buffer))))
5530
5531(defun erc-nick-at-point ()
5532 "Give information about the nickname at `point'.
5533
5534If called interactively, give a human readable message in the
5535minibuffer. If called programatically, return the corresponding
5536entry of `channel-members'."
5537 (interactive)
5538 (require 'thingatpt)
5539 (let* ((word (word-at-point))
5540 (channel-data (erc-get-channel-user word))
5541 (cuser (cdr channel-data))
5542 (user (if channel-data
5543 (car channel-data)
5544 (erc-get-server-user word)))
5545 host login full-name info nick op voice)
5546 (when user
5547 (setq nick (erc-server-user-nickname user)
5548 host (erc-server-user-host user)
5549 login (erc-server-user-login user)
5550 full-name (erc-server-user-full-name user)
5551 info (erc-server-user-info user))
5552 (if cuser
5553 (setq op (erc-channel-user-op cuser)
5554 voice (erc-channel-user-voice cuser)))
5555 (if (interactive-p)
5556 (message "%s is %s@%s%s%s"
5557 nick login host
5558 (if full-name (format " (%s)" full-name) "")
5559 (if (or op voice)
5560 (format " and is +%s%s on %s"
5561 (if op "o" "")
5562 (if voice "v" "")
5563 (erc-default-target))
5564 ""))
5565 user))))
5566
5567(defun erc-away-p ()
5568 "Return t if the current ERC process is set away."
5569 (save-excursion
5570 (and (erc-server-buffer-live-p)
5571 (set-buffer (process-buffer erc-server-process))
5572 erc-away)))
5573
5574;; Mode line handling
5575
5576(defcustom erc-mode-line-format "%s %a"
5577 "A string to be formatted and shown in the mode-line in `erc-mode'.
5578
5579The string is formatted using `format-spec' and the result is set as the value
5580of `mode-line-buffer-identification'.
5581
5582The following characters are replaced:
5583%a: String indicating away status or \"\" if you are not away
5584%m: The modes of the channel
5585%n: The current nick name
5586%o: The topic of the channel
5587%p: The session port
5588%t: The name of the target (channel, nickname, or servername:port)
5589%s: In the server-buffer, this gets filled with the value of
5590 `erc-server-announced-name', in a channel, the value of
5591 (erc-default-target) also get concatenated."
5592 :group 'erc-mode-line-and-header
5593 :type 'string)
5594
5595(defcustom erc-header-line-format "[IRC] %n on %t %m %o"
5596 "A string to be formatted and shown in the header-line in `erc-mode'.
5597Only used in Emacs 21.
5598
5599See `erc-mode-line-format' for which characters are can be used."
5600 :group 'erc-mode-line-and-header
5601 :type 'string)
5602
5603(defcustom erc-header-line-uses-help-echo-p t
5604 "Show the contents of the header line in the echo area or as a tooltip
5605when you move point into the header line."
5606 :group 'erc-mode-line-and-header
5607 :type 'boolean)
5608
5609(defcustom erc-show-channel-key-p t
5610 "Show the the channel key in the header line."
5611 :group 'erc-paranoia
5612 :type 'boolean)
5613
5614(defcustom erc-common-server-suffixes
5615 '(("openprojects.net$" . "OPN")
5616 ("freenode.net$" . "OPN"))
5617 "Alist of common server name suffixes.
5618This variable is used in mode-line display to save screen
5619real estate. Set it to nil if you want to avoid changing
5620displayed hostnames."
5621 :group 'erc-mode-line-and-header
5622 :type 'alist)
5623
5624(defcustom erc-mode-line-away-status-format
5625 "(AWAY since %a %b %d %H:%M) "
5626 "When you're away on a server, this is shown in the mode line.
5627This should be a string with substitution variables recognized by
5628format-time-message."
5629 :group 'erc-mode-line-and-header
5630 :type 'string)
5631
5632(defun erc-shorten-server-name (server-name)
5633 "Shorten SERVER-NAME according to `erc-common-server-suffixes'."
5634 (if (stringp server-name)
5635 (with-temp-buffer
5636 (insert server-name)
5637 (let ((alist erc-common-server-suffixes))
5638 (while alist
5639 (goto-char (point-min))
5640 (if (re-search-forward (caar alist) nil t)
5641 (replace-match (cdar alist)))
5642 (setq alist (cdr alist))))
5643 (buffer-string))))
5644
5645(defun erc-format-target ()
5646 "Return the name of the target (channel or nickname or servername:port)."
5647 (let ((target (erc-default-target)))
5648 (or target
5649 (concat (erc-shorten-server-name
5650 (or erc-server-announced-name
5651 erc-session-server))
5652 ":" (erc-port-to-string erc-session-port)))))
5653
5654(defun erc-format-target-and/or-server ()
5655 "Return the server name or the current target and server name combined."
5656 (let ((server-name (erc-shorten-server-name
5657 (or erc-server-announced-name
5658 erc-session-server))))
5659 (cond ((erc-default-target)
5660 (concat (erc-string-no-properties (erc-default-target))
5661 "@" server-name))
5662 (server-name server-name)
5663 (t (buffer-name (current-buffer))))))
5664
5665(defun erc-format-away-status ()
5666 "Return a formatted `erc-mode-line-away-status-format'
5667if `erc-away' is non-nil."
5668 (let ((a (when (erc-server-buffer-live-p)
5669 (with-current-buffer (process-buffer erc-server-process)
5670 erc-away))))
5671 (if a
5672 (format-time-string erc-mode-line-away-status-format a)
5673 "")))
5674
5675(defun erc-format-channel-modes ()
5676 "Return the current channel's modes and the estimated lag."
5677 (let ((lag (when (erc-server-buffer-live-p)
5678 (with-current-buffer (process-buffer erc-server-process)
5679 erc-server-lag))))
5680 (concat (apply 'concat
5681 "(+" erc-channel-modes)
5682 (cond ((and erc-channel-user-limit erc-channel-key)
5683 (if erc-show-channel-key-p
5684 (format "lk %.0f %s" erc-channel-user-limit
5685 erc-channel-key)
5686 (format "kl %.0f" erc-channel-user-limit)))
5687 (erc-channel-user-limit
5688 ;; Emacs has no bignums
5689 (format "l %.0f" erc-channel-user-limit))
5690 (erc-channel-key
5691 (if erc-show-channel-key-p
5692 (format "k %s" erc-channel-key)
5693 "k"))
5694 (t ""))
5695 (if lag (format ",lag:%.0f" lag) "")
5696 ")")))
5697
5698(defun erc-update-mode-line-buffer (buffer)
5699 "Update the mode line in a single ERC buffer BUFFER."
5700 (with-current-buffer buffer
5701 (let ((spec (format-spec-make
5702 ?a (erc-format-away-status)
5703 ?m (erc-format-channel-modes)
5704 ?n (or (erc-current-nick) "")
5705 ?o (erc-controls-strip erc-channel-topic)
5706 ?p (erc-port-to-string erc-session-port)
5707 ?s (erc-format-target-and/or-server)
5708 ?t (erc-format-target)))
5709 (process-status (cond ((and (erc-server-process-alive)
5710 (not erc-server-connected))
5711 ":connecting")
5712 ((erc-server-process-alive)
5713 "")
5714 (t
5715 ": CLOSED"))))
5716 (cond ((featurep 'xemacs)
5717 (setq modeline-buffer-identification
5718 (list (format-spec erc-mode-line-format spec)))
5719 (setq modeline-process (list process-status)))
5720 (t
5721 (setq mode-line-buffer-identification
5722 (list (format-spec erc-mode-line-format spec)))
5723 (setq mode-line-process (list process-status))))
5724 (when (boundp 'header-line-format)
5725 (let ((header (if erc-header-line-format
5726 (format-spec erc-header-line-format spec)
5727 nil)))
5728 (cond ((null header)
5729 (setq header-line-format nil))
5730 (erc-header-line-uses-help-echo-p
5731 (let ((help-echo (with-temp-buffer
5732 (insert header)
5733 (fill-region (point-min) (point-max))
5734 (buffer-string))))
5735 (setq header-line-format
5736 (erc-replace-regexp-in-string
5737 "%"
5738 "%%"
5739 (erc-propertize header 'help-echo help-echo)))))
5740 (t (setq header-line-format header))))))
5741 (if (featurep 'xemacs)
5742 (redraw-modeline)
5743 (force-mode-line-update))))
5744
5745(defun erc-update-mode-line (&optional buffer)
5746 "Update the mode line in BUFFER.
5747
5748If BUFFER is nil, update the mode line in all ERC buffers."
5749 (if (and buffer (bufferp buffer))
5750 (erc-update-mode-line-buffer buffer)
5751 (dolist (buf (erc-buffer-list))
5752 (when (buffer-live-p buf)
5753 (erc-update-mode-line-buffer buf)))))
5754
5755;; Miscellaneous
5756
5757(defun erc-port-to-string (p)
5758 "Convert port P to a string.
5759P may be an integer or a service name."
5760 (if (integerp p)
5761 (int-to-string p)
5762 p))
5763
5764(defun erc-string-to-port (s)
5765 "Convert string S to either an integer port number or a service name."
5766 (let ((n (string-to-number s)))
5767 (if (= n 0)
5768 s
5769 n)))
5770
5771(defun erc-version (&optional here)
5772 "Show the version number of ERC in the minibuffer.
5773If optional argument HERE is non-nil, insert version number at point."
5774 (interactive "P")
5775 (let ((version-string
5776 (format "ERC %s" erc-version-string)))
5777 (if here
5778 (insert version-string)
5779 (if (interactive-p)
5780 (message "%s" version-string)
5781 version-string))))
5782
5783(defun erc-version-modules (&optional here)
5784 "Show the version numbers of all loaded ERC modules in the minibuffer.
5785If optional argument HERE is non-nil, insert version number at point."
5786 (interactive "P")
5787 (let ((version-string
5788 (mapconcat 'identity
5789 (let (versions (case-fold-search nil))
5790 (dolist (var (apropos-internal "^erc-.*version$"))
5791 (when (and (boundp var)
5792 (stringp (symbol-value var)))
5793 (setq versions (cons (format "%S: %s"
5794 var (symbol-value var))
5795 versions))))
5796 versions) ", ")))
5797 (if here
5798 (insert version-string)
5799 (if (interactive-p)
5800 (message "%s" version-string)
5801 version-string))))
5802
5803(defun erc-modes (&optional here)
5804 "Show the active ERC modes in the minibuffer.
5805If optional argument HERE is non-nil, insert version number at point."
5806 (interactive "P")
5807 (let ((string
5808 (mapconcat 'identity
5809 (let (modes (case-fold-search nil))
5810 (dolist (var (apropos-internal "^erc-.*mode$"))
5811 (when (and (boundp var)
5812 (symbol-value var))
5813 (setq modes (cons (symbol-name var)
5814 modes))))
5815 modes)
5816 ", ")))
5817 (if here
5818 (insert string)
5819 (if (interactive-p)
5820 (message "%s" string)
5821 string))))
5822
5823(defun erc-latest-version ()
5824 "Retrieve the latest erc.el version from CVS."
5825 (interactive)
5826 (if (ignore-errors (require 'url))
5827 (progn
5828 (switch-to-buffer (get-buffer-create "*erc.el latest version*"))
5829 (delete-region (point-min) (point-max))
5830 (kill-all-local-variables)
5831 (url-insert-file-contents (concat
5832 "http://cvs.sourceforge.net/viewcvs.py/"
5833 "*checkout*/erc/erc/erc.el?content-type"
5834 "=text%2Fplain&rev=HEAD"))
5835 (emacs-lisp-mode)
5836 (current-buffer))
5837 (error "URL needs to be installed")))
5838
5839(defun erc-ediff-latest-version ()
5840 "Ediff your installed erc.el with the latest CVS version.
5841See also `erc-latest-version'."
5842 (interactive)
5843 (let ((current (locate-library "erc.el")))
5844 (if current
5845 (ediff-buffers (find-file current)
5846 (erc-latest-version))
5847 (error "You do not appear to have the uncompiled erc.el file"))))
5848
5849(defun erc-trim-string (s)
5850 "Trim leading and trailing spaces off S."
5851 (cond
5852 ((not (stringp s)) nil)
5853 ((string-match "^\\s-*$" s)
5854 "")
5855 ((string-match "^\\s-*\\(.*\\S-\\)\\s-*$" s)
5856 (match-string 1 s))
5857 (t
5858 s)))
5859
5860(defun erc-arrange-session-in-multiple-windows ()
5861 "Open a window for every non-server buffer related to `erc-session-server'.
5862
5863All windows are opened in the current frame."
5864 (interactive)
5865 (unless (boundp 'erc-server-process)
5866 (error "No erc-process found in current buffer"))
5867 (let ((bufs (erc-buffer-list nil erc-server-process)))
5868 (when bufs
5869 (delete-other-windows)
5870 (switch-to-buffer (car bufs))
5871 (setq bufs (cdr bufs))
5872 (while bufs
5873 (split-window)
5874 (switch-to-buffer-other-window (car bufs))
5875 (setq bufs (cdr bufs))
5876 (balance-windows)))))
5877
5878(defun erc-popup-input-buffer ()
5879 "Provide a input buffer."
5880 (interactive)
5881 (let ((buffer-name (generate-new-buffer-name "*ERC input*"))
5882 (mode (intern
5883 (completing-read
5884 "Mode: "
5885 (mapcar (lambda (e)
5886 (list (symbol-name e)))
5887 (apropos-internal "-mode$" 'commandp))
5888 nil t))))
5889 (pop-to-buffer (make-indirect-buffer (current-buffer) buffer-name))
5890 (funcall mode)
5891 (narrow-to-region (point) (point))
5892 (shrink-window-if-larger-than-buffer)))
5893
5894;;; Message catalog
5895
5896(defun erc-make-message-variable-name (catalog entry)
5897 "Create a variable name corresponding to CATALOG's ENTRY."
5898 (intern (concat "erc-message-"
5899 (symbol-name catalog) "-" (symbol-name entry))))
5900
5901(defun erc-define-catalog-entry (catalog entry format-spec)
5902 "Set CATALOG's ENTRY to FORMAT-SPEC."
5903 (set (erc-make-message-variable-name catalog entry)
5904 format-spec))
5905
5906(defun erc-define-catalog (catalog entries)
5907 "Define a CATALOG according to ENTRIES."
5908 (dolist (entry entries)
5909 (erc-define-catalog-entry catalog (car entry) (cdr entry))))
5910
5911(erc-define-catalog
5912 'english
5913 '((bad-ping-response . "Unexpected PING response from %n (time %t)")
5914 (bad-syntax . "Error occurred - incorrect usage?\n%c %u\n%d")
5915 (incorrect-args . "Incorrect arguments. Usage:\n%c %u\n%d")
5916 (cannot-find-file . "Cannot find file %f")
5917 (cannot-read-file . "Cannot read file %f")
5918 (connect . "Connecting to %S:%p... ")
5919 (country . "%c")
5920 (country-unknown . "%d: No such domain")
5921 (ctcp-empty . "Illegal empty CTCP query received from %n. Ignoring.")
5922 (ctcp-request . "==> CTCP request from %n (%u@%h): %r")
5923 (ctcp-request-to . "==> CTCP request from %n (%u@%h) to %t: %r")
5924 (ctcp-too-many . "Too many CTCP queries in single message. Ignoring")
5925 (flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.")
5926 (flood-strict-mode . "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
5927 (disconnected . "Connection failed! Re-establishing connection...")
5928 (disconnected-noreconnect . "Connection failed! Not re-establishing connection.")
5929 (login . "Logging in as \'%n\'...")
5930 (nick-in-use . "%n is in use. Choose new nickname: ")
5931 (nick-too-long . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
5932 (no-default-channel . "No default channel")
5933 (no-invitation . "You've got no invitation")
5934 (no-target . "No target")
5935 (ops . "%i operator%s: %o")
5936 (ops-none . "No operators in this channel.")
5937 (undefined-ctcp . "Undefined CTCP query received. Silently ignored")
5938 (variable-not-bound . "Variable not bound!")
5939 (ACTION . "* %n %a")
5940 (CTCP-CLIENTINFO . "Client info for %n: %m")
5941 (CTCP-ECHO . "Echo %n: %m")
5942 (CTCP-FINGER . "Finger info for %n: %m")
5943 (CTCP-PING . "Ping time to %n is %t")
5944 (CTCP-TIME . "Time by %n is %m")
5945 (CTCP-UNKNOWN . "Unknown CTCP message from %n (%u@%h): %m")
5946 (CTCP-VERSION . "Version for %n is %m")
5947 (ERROR . "==> ERROR from %s: %c\n")
5948 (INVITE . "%n (%u@%h) invites you to channel %c")
5949 (JOIN . "%n (%u@%h) has joined channel %c")
5950 (JOIN-you . "You have joined channel %c")
5951 (KICK . "%n (%u@%h) has kicked %k off channel %c: %r")
5952 (KICK-you . "You have been kicked off channel %c by %n (%u@%h): %r")
5953 (KICK-by-you . "You have kicked %k off channel %c: %r")
5954 (MODE . "%n (%u@%h) has changed mode for %t to %m")
5955 (MODE-nick . "%n has changed mode for %t to %m")
5956 (NICK . "%n (%u@%h) is now known as %N")
5957 (NICK-you . "Your new nickname is %N")
5958 (PART . erc-message-english-PART)
5959 (PING . "PING from server (last: %s sec. ago)")
5960 (PONG . "PONG from %h (%i second%s)")
5961 (QUIT . "%n (%u@%h) has quit: %r")
5962 (TOPIC . "%n (%u@%h) has set the topic for %c: \"%T\"")
5963 (WALLOPS . "Wallops from %n: %m")
5964 (s004 . "%s %v %U %C")
5965 (s221 . "User modes for %n: %m")
5966 (s252 . "%i operator(s) online")
5967 (s253 . "%i unknown connection(s)")
5968 (s254 . "%i channels formed")
5969 (s301 . "%n is AWAY: %r")
5970 (s303 . "Is online: %n")
5971 (s305 . "%m")
5972 (s306 . "%m")
5973 (s311 . "%n is %f (%u@%h)")
5974 (s312 . "%n is/was on server %s (%c)")
5975 (s313 . "%n is an IRC operator")
5976 (s314 . "%n was %f (%u@%h)")
5977 (s317 . "%n has been idle for %i")
5978 (s317-on-since . "%n has been idle for %i, on since %t")
5979 (s319 . "%n is on channel(s): %c")
5980 (s320 . "%n is an identified user")
5981 (s321 . "Channel Users Topic")
5982 (s322 . "%c [%u] %t")
5983 (s324 . "%c modes: %m")
5984 (s329 . "%c was created on %t")
5985 (s330 . "%n %a %i")
5986 (s331 . "No topic is set for %c")
5987 (s332 . "Topic for %c: %T")
5988 (s333 . "%c: topic set by %n, %t")
5989 (s341 . "Inviting %n to channel %c")
5990 (s352 . "%-11c %-10n %-4a %u@%h (%f)")
5991 (s353 . "Users on %c: %u")
5992 (s367 . "Ban on %b on %c set by %s on %t (Use /banlist!)")
5993 (s368 . "Banlist of %c ends.")
5994 (s379 . "%c: Forwarded to %f")
5995 (s391 . "The time at %s is %t")
5996 (s401 . "%n: No such nick/channel")
5997 (s403 . "%c: No such channel")
5998 (s404 . "%c: Cannot send to channel")
5999 (s405 . "%c: You have joined too many channels")
6000 (s406 . "%n: There was no such nickname")
6001 (s412 . "No text to send")
6002 (s421 . "%c: Unknown command")
6003 (s431 . "No nickname given")
6004 (s432 . "%n is an erroneous nickname")
6005 (s442 . "%c: You're not on that channel")
6006 (s445 . "SUMMON has been disabled")
6007 (s446 . "USERS has been disabled")
6008 (s451 . "You have not registered")
6009 (s461 . "%c: not enough parameters")
6010 (s462 . "Unauthorized command (already registered)")
6011 (s463 . "Your host isn't among the privileged")
6012 (s464 . "Password incorrect")
6013 (s465 . "You are banned from this server")
6014 (s474 . "You can't join %c because you're banned (+b)")
6015 (s475 . "You must specify the correct channel key (+k) to join %c")
6016 (s481 . "Permission Denied - You're not an IRC operator")
6017 (s482 . "You need to be a channel operator of %c to do that")
6018 (s483 . "You can't kill a server!")
6019 (s484 . "Your connection is restricted!")
6020 (s485 . "You're not the original channel operator")
6021 (s491 . "No O-lines for your host")
6022 (s501 . "Unknown MODE flag")
6023 (s502 . "You can't change modes for other users")))
6024
6025(defun erc-message-english-PART (&rest args)
6026 "Format a proper PART message.
6027
6028This function is an example on what could be done with formatting
6029functions."
6030 (let ((nick (cadr (memq ?n args)))
6031 (user (cadr (memq ?u args)))
6032 (host (cadr (memq ?h args)))
6033 (channel (cadr (memq ?c args)))
6034 (reason (cadr (memq ?r args))))
6035 (if (string= nick (erc-current-nick))
6036 (format "You have left channel %s" channel)
6037 (format "%s (%s@%s) has left channel %s%s"
6038 nick user host channel
6039 (if (not (string= reason ""))
6040 (format ": %s" reason)
6041 "")))))
6042
6043
6044(defvar erc-current-message-catalog 'english)
6045(make-variable-buffer-local 'erc-current-message-catalog)
6046
6047(defun erc-retrieve-catalog-entry (entry &optional catalog)
6048 "Retrieve ENTRY from CATALOG.
6049
6050If CATALOG is nil, `erc-current-message-catalog' is used.
6051
6052If ENTRY is nil in CATALOG, it is retrieved from the fallback,
6053english, catalog."
6054 (unless catalog (setq catalog erc-current-message-catalog))
6055 (let ((var (erc-make-message-variable-name catalog entry)))
6056 (if (boundp var)
6057 (symbol-value var)
6058 (when (boundp (erc-make-message-variable-name 'english entry))
6059 (symbol-value (erc-make-message-variable-name 'english entry))))))
6060
6061(defun erc-format-message (msg &rest args)
6062 "Format MSG according to ARGS.
6063
6064See also `format-spec'."
6065 (when (eq (logand (length args) 1) 1) ; oddp
6066 (error "Obscure usage of this function appeared"))
6067 (let ((entry (erc-retrieve-catalog-entry msg)))
6068 (when (not entry)
6069 (error "No format spec for message %s" msg))
6070 (when (functionp entry)
6071 (setq entry (apply entry args)))
6072 (format-spec entry (apply 'format-spec-make args))))
6073
6074;;; Various hook functions
6075
6076(add-hook 'kill-buffer-hook 'erc-kill-buffer-function)
6077
6078(defcustom erc-kill-server-hook '(erc-kill-server)
6079 "*Invoked whenever a server-buffer is killed via `kill-buffer'."
6080 :group 'erc-hooks
6081 :type 'hook)
6082
6083(defcustom erc-kill-channel-hook '(erc-kill-channel)
6084 "*Invoked whenever a channel-buffer is killed via `kill-buffer'."
6085 :group 'erc-hooks
6086 :type 'hook)
6087
6088(defcustom erc-kill-buffer-hook nil
6089 "*Hook run whenever a non-server or channel buffer is killed.
6090
6091See also `kill-buffer'."
6092 :group 'erc-hooks
6093 :type 'hook)
6094
6095(defun erc-kill-buffer-function ()
6096 "Function to call when an ERC buffer is killed.
6097This function should be on `kill-buffer-hook'.
6098When the current buffer is in `erc-mode', this function will run
6099one of the following hooks:
6100`erc-kill-server-hook' if the server buffer was killed,
6101`erc-kill-channel-hook' if a channel buffer was killed,
6102or `erc-kill-buffer-hook' if any other buffer."
6103 (when (eq major-mode 'erc-mode)
6104 (erc-remove-channel-users)
6105 (cond
6106 ((eq (erc-server-buffer) (current-buffer))
6107 (run-hooks 'erc-kill-server-hook))
6108 ((erc-channel-p (erc-default-target))
6109 (run-hooks 'erc-kill-channel-hook))
6110 (t
6111 (run-hooks 'erc-kill-buffer-hook)))))
6112
6113(defun erc-kill-server ()
6114 "Sends a QUIT command to the server when the server buffer is killed.
6115This function should be on `erc-kill-server-hook'."
6116 (when (erc-server-process-alive)
6117 (setq erc-server-quitting t)
6118 (erc-server-send (format "QUIT :%s" (funcall erc-quit-reason nil)))))
6119
6120(defun erc-kill-channel ()
6121 "Sends a PART command to the server when the channel buffer is killed.
6122This function should be on `erc-kill-channel-hook'."
6123 (when (erc-server-process-alive)
6124 (let ((tgt (erc-default-target)))
6125 (erc-server-send (format "PART %s :%s" tgt
6126 (funcall erc-part-reason nil))
6127 nil tgt))))
6128
6129(provide 'erc)
6130
6131;;; Deprecated. We might eventually stop requiring the goodies automatically.
6132;;; IMPORTANT: This require must appear _after_ the above (provide 'erc) to
6133;;; avoid a recursive require error when byte-compiling the entire package.
6134(require 'erc-goodies)
6135
6136;;; erc.el ends here
6137;;
6138;; Local Variables:
6139;; outline-regexp: ";;+"
6140;; indent-tabs-mode: t
6141;; tab-width: 8
6142;; End:
6143
6144;; arch-tag: d19587f6-627e-48c1-8d86-58595fa3eca3
diff --git a/man/ChangeLog b/man/ChangeLog
index 810fe60e3fc..209493e0391 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,11 @@
12006-01-29 Michael Olson <mwolson@gnu.org>
2
3 * makefile.w32-in ($(infodir)/erc, erc.dvi): New targets.
4
5 * Makefile.in (INFO_TARGETS, DVI_TARGETS): Add ERC.
6
7 * faq.texi (New in Emacs 22): Mention ERC.
8
12006-01-28 Luc Teirlinck <teirllm@auburn.edu> 92006-01-28 Luc Teirlinck <teirllm@auburn.edu>
2 10
3 * rcirc.texi: Capitalize dir entry for consistency with the entry 11 * rcirc.texi: Capitalize dir entry for consistency with the entry
diff --git a/man/Makefile.in b/man/Makefile.in
index bf1553a173d..78e282b6563 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -42,7 +42,7 @@ INFO_TARGETS = ../info/emacs ../info/emacs-xtra ../info/ccmode ../info/cl \
42 ../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \ 42 ../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \
43 ../info/woman ../info/eshell ../info/org ../info/url \ 43 ../info/woman ../info/eshell ../info/org ../info/url \
44 ../info/speedbar ../info/tramp ../info/ses ../info/smtpmail \ 44 ../info/speedbar ../info/tramp ../info/ses ../info/smtpmail \
45 ../info/flymake ../info/newsticker ../info/rcirc 45 ../info/flymake ../info/newsticker ../info/rcirc ../info/erc
46DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \ 46DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
47 ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \ 47 ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
48 gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \ 48 gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
@@ -50,7 +50,7 @@ DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
50 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \ 50 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
51 pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \ 51 pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
52 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \ 52 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
53 newsticker.dvi emacs-xtra.dvi rcirc.dvi 53 newsticker.dvi emacs-xtra.dvi rcirc.dvi erc.dvi
54INFOSOURCES = info.texi 54INFOSOURCES = info.texi
55 55
56# The following rule does not work with all versions of `make'. 56# The following rule does not work with all versions of `make'.
@@ -332,6 +332,11 @@ newsticker.dvi: newsticker.texi
332rcirc.dvi: rcirc.texi 332rcirc.dvi: rcirc.texi
333 $(ENVADD) $(TEXI2DVI) ${srcdir}/rcirc.texi 333 $(ENVADD) $(TEXI2DVI) ${srcdir}/rcirc.texi
334 334
335../info/erc: erc.texi
336 cd $(srcdir); $(MAKEINFO) erc.texi
337erc.dvi: erc.texi
338 $(ENVADD) $(TEXI2DVI) ${srcdir}/erc.texi
339
335mostlyclean: 340mostlyclean:
336 rm -f *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.* 341 rm -f *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
337 342
diff --git a/man/erc.texi b/man/erc.texi
new file mode 100644
index 00000000000..d4053e5e737
--- /dev/null
+++ b/man/erc.texi
@@ -0,0 +1,624 @@
1\input texinfo
2@c %**start of header
3@setfilename ../info/erc
4@settitle ERC Manual
5@c %**end of header
6
7@dircategory Emacs
8@direntry
9* ERC: (erc). Powerful, modular, and extensible IRC client for Emacs.
10@end direntry
11
12@syncodeindex fn cp
13
14@copying
15This manual is for ERC version 5.1.
16
17Copyright @copyright{} 2005, 2006 Free Software Foundation, Inc.
18
19@quotation
20Permission is granted to copy, distribute and/or modify this document
21under the terms of the GNU Free Documentation License, Version 1.2 or
22any later version published by the Free Software Foundation; with no
23Invariant Sections, Front-Cover texts, or Back-Cover Texts.
24@end quotation
25@end copying
26
27@titlepage
28@title ERC manual
29@subtitle a full-featured IRC client
30@subtitle for GNU Emacs and XEmacs
31
32@c The following two commands
33@c start the copyright page.
34@page
35@vskip 0pt plus 1filll
36@insertcopying
37@end titlepage
38
39@c So the toc is printed at the start
40@contents
41
42@ifnottex
43@node Top, Introduction, (dir), (dir)
44@comment node-name, next, previous, up
45@top ERC
46
47@insertcopying
48@end ifnottex
49
50@menu
51* Introduction:: What is ERC?
52* Obtaining ERC:: How to get ERC releases and development
53 versions.
54* Installation:: Compiling and installing ERC.
55* Getting Started:: Quick Start guide to using ERC.
56* Keystroke Summary:: Keystrokes used in ERC buffers.
57* Modules:: Available modules for ERC.
58* Advanced Usage:: Cool ways of using ERC.
59* Getting Help and Reporting Bugs::
60* History:: The history of ERC.
61* Concept Index:: Search for terms.
62
63@detailmenu
64 --- The Detailed Node Listing ---
65
66Obtaining ERC
67
68* Releases:: Released versions of ERC.
69* Development:: Latest unreleased development changes.
70
71@end detailmenu
72@end menu
73
74@node Introduction, Obtaining ERC, Top, Top
75@comment node-name, next, previous, up
76@chapter Introduction
77
78ERC is a powerful, modular, and extensible IRC client for Emacs.
79
80It comes with the following capabilities enabled by default.
81
82@itemize @bullet
83@item Flood control
84@item Timestamps
85@item Join channels automatically
86@item Buttonize URLs, nicknames, and other text
87@item Wrap long lines
88@item Highlight or remove IRC control characters
89@item Highlight pals, fools, and other keywords
90@item Detect netsplits
91@item Complete nicknames and commands in a programmable fashion
92@item Make displayed lines read-only
93@item Input history
94@item Track channel activity in the mode-line
95
96@end itemize
97
98@node Obtaining ERC, Installation, Introduction, Top
99@comment node-name, next, previous, up
100@chapter Obtaining ERC
101
102@menu
103* Releases:: Released versions of ERC.
104* Development:: Latest unreleased development changes.
105@end menu
106
107These sections may be skipped if you are using the version of ERC that
108comes with Emacs.
109
110@node Releases, Development, Obtaining ERC, Obtaining ERC
111@comment node-name, next, previous, up
112@section Releases
113
114Choose to install a release if you want to minimize risk.
115
116Errors are corrected in development first. User-visible changes will be
117announced on the @email{erc-help@@lists.sourceforge.net} mailing list.
118@pxref{Getting Help and Reporting Bugs}.
119
120@cindex releases, Debian package
121@cindex Debian package for ERC
122Debian users can get ERC via apt-get. The @file{erc} package is
123available in the official Debian repository.
124
125@cindex releases, from source
126Alternatively, you can download the latest release from
127@uref{http://sourceforge.net/project/showfiles.php?group_id=30118}.
128
129@node Development, , Releases, Obtaining ERC
130@comment node-name, next, previous, up
131@section Development
132@cindex development
133
134Choose the development version if you want to live on the bleeding edge
135of ERC development or try out new features before release.
136
137@subsection Using CVS
138@cindex CVS, using
139
140ERC is primarily developed using a CVS repository on sourceforge.net.
141To check out a copy of the latest changes, do the following.
142
143@example
144cvs -d:pserver:anonymous@@cvs.sourceforge.net:/cvsroot/erc login
145cvs -z3 -d:pserver:anonymous@@cvs.sourceforge.net:/cvsroot/erc co -P erc
146@end example
147
148@cindex CVS snapshot
149Alternatively, the latest CVS snapshot may be downloaded in the
150following forms.
151
152@itemize @bullet
153@item http://mwolson.org/static/dist/erc-latest.tar.gz
154@item http://mwolson.org/static/dist/erc-latest.zip
155@end itemize
156
157@subsection Using the GNU Arch Revision Control System
158@cindex arch revision control system, using
159The Arch revision control system allows you to retrieve previous
160versions and select specific features and bug fixes.
161
162Michael Olson maintains an official Arch branch for ERC which stays
163current with the CVS repository for ERC. If you would like to
164contribute to ERC development, and would prefer to use a modern Revision
165Control System, feel free to make your own branch.
166
167If you are new to Arch, you might find this tutorial helpful:
168@uref{http://www.mwolson.org/projects/ArchTutorial.html}.
169
170Downloading ERC with Arch and staying up-to-date involves the following
171steps.
172
173@enumerate
174@item Install arch
175
176@itemize @bullet
177@item Debian: @kbd{apt-get install tla}.
178@item Other distributions: see @uref{ftp://ftp.gnu.org/gnu/gnu-arch/}.
179@end itemize
180
181@item Register the archive.
182@example
183tla register-archive -f http://www.mwolson.org/archives/2006
184@end example
185
186@item Download the ERC source code.
187@example
188# Download ERC into the @file{erc} directory.
189tla get mwolson@@gnu.org--2006/erc--cvs--0 erc
190@end example
191
192@item List upstream changes that are missing from your local copy.
193Do this whenever you want to see whether new changes have been committed
194to ERC.
195
196@example
197# Change to the source directory you are interested in.
198cd erc/
199
200# Display the summary of changes
201tla missing --summary
202@end example
203
204@cindex updating ERC with Arch
205@item Update to the latest version by replaying missing changes.
206@example
207cd erc
208tla replay
209@end example
210
211@end enumerate
212
213There are other ways to interact with the ERC archive.
214
215@itemize
216@item Browse arch repository: @uref{http://www.mwolson.org/archives/}
217@item Latest development snapshot: @uref{http://www.mwolson.org/static/dist/erc-latest.tar.gz}
218@end itemize
219
220The latest development snapshot will be kept up-to-date since it is
221updated at the same time as the Arch repository.
222
223
224@node Installation, Getting Started, Obtaining ERC, Top
225@comment node-name, next, previous, up
226@chapter Installation
227
228ERC may be compiled and installed on your machine.
229
230This section may be skipped if you are using the version of ERC that
231comes with Emacs.
232
233@subsubheading Compilation
234
235This is an optional step, since Emacs Lisp source code does not
236necessarily have to be byte-compiled. It will yield a speed increase,
237though.
238
239A working copy of Emacs or XEmacs is needed in order to compile ERC. By
240default, the program that is installed with the name @command{emacs}
241will be used.
242
243If you want to use the @command{xemacs} binary to perform the
244compilation, you would need to edit @file{Makefile} in the top-level
245directory as follows. You can put either a full path to an Emacs or
246XEmacs binary or just the command name, as long as it is in the
247@env{PATH}.
248
249@example
250EMACS = xemacs
251SITEFLAG = -no-site-file
252@end example
253
254Running @code{make} should compile the ERC source files in the
255@file{lisp} directory.
256
257@subsubheading Installation
258
259ERC may be installed into your file hierarchy by doing the following.
260
261Edit the @file{Makefile} file so that @env{ELISPDIR} points to where you
262want the source and compiled ERC files to be installed and
263@env{INFODIR} indicates where to put the ERC manual. Of course, you
264will want to edit @env{EMACS} and @env{SITEFLAG} as shown in the
265Compilation section if you are using XEmacs.
266
267If you are installing ERC on a Debian system, you might want to change
268the value of @env{INSTALLINFO} as specified in @file{Makefile}.
269
270Run @code{make} as a normal user.
271
272Run @code{make install} as the root user if you have chosen installation
273locations that require this.
274
275
276@node Getting Started, Keystroke Summary, Installation, Top
277@comment node-name, next, previous, up
278@chapter Getting Started
279@cindex settings
280
281@c PRE5_2: Mention .ercrc.el
282
283To use ERC, add the directory containing its files to your
284@code{load-path} variable, in your @file{.emacs} file. Then, load ERC
285itself along with any extra modules you desire. An example follows.
286
287@lisp
288(require 'erc)
289
290(require 'erc-spelling)
291@end lisp
292
293Once this is loaded, the command @kbd{M-x erc-select} will start ERC and
294prompt for the server to connect to.
295
296@c PRE5_2: Sample session, including:
297@c - connect to Freenode
298@c - /join #emacs
299@c - see messages flying past, point out topic lines, messages, channel
300@c members
301@c - identifying your nick with NickServ (most IRC servers have this)
302@c - talking to the channel
303@c - open a /query buffer to talk to someone (must identify first in
304@c FreeNode)
305
306
307@node Keystroke Summary, Modules, Getting Started, Top
308@comment node-name, next, previous, up
309@chapter Keys Used in ERC
310@cindex keystrokes
311
312This is a summary of keystrokes available in every ERC buffer.
313
314@table @kbd
315
316@item C-a or <home> (`erc-bol')
317Go to beginning of line or end of prompt.
318
319@item RET (`erc-send-current-line')
320Send the current line
321
322@item TAB (`erc-complete-word')
323If at prompt, complete the current word.
324Otherwise, move to the next link or button.
325
326@item M-TAB (`ispell-complete-word')
327Complete the given word, using ispell.
328
329@item C-c C-a (`erc-bol')
330Go to beginning of line or end of prompt.
331
332@item C-c C-b (`erc-iswitchb')
333Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to.
334
335@item C-c C-c (`erc-toggle-interpret-controls')
336Toggle interpretation of control sequences in messages.
337
338@item C-c C-d (`erc-input-action')
339Interactively input a user action and send it to IRC.
340
341@item C-c C-e (`erc-toggle-ctcp-autoresponse')
342Toggle automatic CTCP replies (like VERSION and PING).
343
344@item C-c C-f (`erc-toggle-flood-control')
345Toggle use of flood control on sent messages.
346
347@item C-c TAB (`erc-invite-only-mode')
348Turn on the invite only mode (+i) for the current channel.
349
350@item C-c C-j (`erc-join-channel')
351Join channel. If point is at the beginning of a channel name, use that
352as default.
353
354@item C-c C-k (`erc-go-to-log-matches-buffer')
355Interactively open an erc-log-matches buffer
356
357@item C-c C-l (`erc-save-buffer-in-logs')
358Append buffer contents to the log file, if logging is enabled.
359
360@item C-c C-n (`erc-channel-names')
361Run "/names #channel" in the current channel.
362
363@item C-c C-o (`erc-get-channel-mode-from-keypress')
364Read a key sequence and call the corresponding channel mode function.
365After doing C-c C-o type in a channel mode letter.
366
367C-g means quit.
368RET let's you type more than one mode at a time.
369If "l" is pressed, `erc-set-channel-limit' gets called.
370If "k" is pressed, `erc-set-channel-key' gets called.
371Anything else will be sent to `erc-toggle-channel-mode'.
372
373@item C-c C-p (`erc-part-from-channel')
374Part from the current channel and prompt for a reason.
375
376@item C-c C-q (`erc-quit-server')
377Disconnect from current server after prompting for reason.
378
379@item C-c C-r (`erc-remove-text-properties-region')
380Clears the region (start,end) in object from all colors, etc.
381
382@item C-c C-t (`erc-set-topic')
383Prompt for a topic for the current channel.
384
385@item C-c C-u (`erc-kill-input')
386Kill current input line using `erc-bol' followed by `kill-line'.
387
388@end table
389
390
391@node Modules, Advanced Usage, Keystroke Summary, Top
392@comment node-name, next, previous, up
393@chapter Modules
394@cindex modules
395
396One way to add functionality to ERC is to customize which of its many
397modules are loaded.
398
399There is a spiffy customize interface, which may be reached by typing
400@kbd{M-x customize-option erc-modules RET}. Alternatively, set
401@code{erc-modules} manually and then call @code{erc-update-modules}.
402
403The following is a list of available modules.
404
405@table @code
406
407@cindex modules, autoaway
408@item autoaway
409Set away status automatically.
410
411@cindex modules, autojoin
412@item autojoin
413Join channels automatically
414
415@cindex modules, bbdb
416@item bbdb
417Integrate with the Big Brother Database
418
419@cindex modules, button
420@item button
421Buttonize URLs, nicknames, and other text
422
423@cindex modules, fill
424@item fill
425Wrap long lines
426
427@cindex modules, irccontrols
428@item irccontrols
429Highlight or remove IRC control characters
430
431@cindex modules, log
432@item log
433Save buffers in logs
434
435@cindex modules, match
436@item match
437Highlight pals, fools, and other keywords
438
439@cindex modules, netsplit
440@item netsplit
441Detect netsplits
442
443@cindex modules, noncommands
444@item noncommands
445Don't display non-IRC commands after evaluation
446
447@cindex modules, notify
448@item notify
449Notify when the online status of certain users changes
450
451@cindex modules, pcomplete
452@item pcomplete
453Complete nicknames and commands (programmable)
454
455@cindex modules, readonly
456@item readonly
457Make displayed lines read-only
458
459@cindex modules, replace
460@item replace
461Replace text in messages
462
463@cindex modules, ring
464@item ring
465Enable an input history
466
467@cindex modules, scrolltobottom
468@item scrolltobottom
469Scroll to the bottom of the buffer
470
471@cindex modules, services
472@item services
473Identify to Nickserv (IRC Services) automatically
474
475@cindex modules, smiley
476@item smiley
477Convert smileys to pretty icons
478
479@cindex modules, sound
480@item sound
481Play sounds when you receive CTCP SOUND requests
482
483@cindex modules, spell
484@item spell
485Check spelling
486
487@cindex modules, stamp
488@item stamp
489Add timestamps to messages
490
491@cindex modules, track
492@item track
493Track channel activity in the mode-line
494
495@cindex modules, truncate
496@item truncate
497Truncate buffers to a certain size
498
499@cindex modules, unmorse
500@item unmorse
501Translate morse code in messages
502
503@end table
504
505@c PRE5_2: Document every option of every module in its own subnode
506
507
508@node Advanced Usage, Getting Help and Reporting Bugs, Modules, Top
509@comment node-name, next, previous, up
510@chapter Advanced Usage
511@cindex advanced topics
512
513Write me.
514
515@c PRE5_2: (Node) Document every ERC option
516
517@c PRE5_2: (Node) Tips and tricks
518
519@c PRE5_2: (Node) Sample configs
520
521
522@node Getting Help and Reporting Bugs, History, Advanced Usage, Top
523@comment node-name, next, previous, up
524@chapter Getting Help and Reporting Bugs
525@cindex help, getting
526@cindex bugs, reporting
527
528After you have read this guide, if you still have questions about ERC,
529or if you have bugs to report, there are several places you can go.
530
531@itemize @bullet
532
533@item
534@uref{http://www.emacswiki.org/cgi-bin/wiki/EmacsIRCClient} is the
535emacswiki.org page for ERC. Anyone may add tips, hints, or bug
536descriptions to it.
537
538@item
539You can join the mailing list at @email{erc-help@@lists.sourceforge.net}
540using the subscription form at
541@uref{http://lists.sourceforge.net/lists/listinfo/erc-help}.
542
543This mailing list is also available via Gmane
544(@url{http://gmane.org/}). The group is called
545@samp{gmane.emacs.erc.general}. This provides additional methods for
546accessing the mailing list, adding content to it, and searching it.
547
548@item
549You can visit the IRC Freenode channel @samp{#emacs}. Many of the
550contributors are frequently around and willing to answer your
551questions.
552
553@end itemize
554
555
556@node History, Concept Index, Getting Help and Reporting Bugs, Top
557@comment node-name, next, previous, up
558@chapter History
559@cindex history, of ERC
560
561ERC was originally written by Alexander L. Belikoff
562@email{abel@@bfr.co.il} and Sergey Berezin
563@email{sergey.berezin@@cs.cmu.edu}. They stopped development around
564december 1999. Their last released version was ERC 2.0.
565
566P.S.: If one of the original developers of ERC reads this, we'd like to
567receive additional information for this file and hear comments in
568general.
569
570@itemize
571@item 2001
572
573In June 2001, Mario Lang @email{mlang@@delysid.org} and Alex Schroeder
574@email{alex@@gnu.org} took over development and created a ERC Project at
575sourceforge.net.
576
577In reaction to a mail about the new erc development, Sergey Berezin
578said, "First of all, I'm glad that my version of ERC is being used out
579there. The thing is, I do not have free time and enough incentive
580anymore to work on ERC, so I would be happy if you guys take over the
581project entirely."
582
583So we happily hacked away on ERC, and soon after (september 2001)
584released the next "stable" version, 2.1.
585
586Most of the development of the new ERC happend on #emacs on
587irc.openprojects.net. Over time, many people contributed code, ideas,
588bugfixes. And not to forget alot of alpha/beta/gamma testing.
589
590See the @file{CREDITS} file for a list of contributors.
591
592@item 2003
593
594ERC 3.0 is released.
595
596@item 2004
597
598ERC 4.0 is released.
599
600@item 2005
601
602ERC 5.0 is released. Michael Olson @email{mwolson@@gnu.org} becomes
603the release manager and eventually the maintainer.
604
605After some discussion between him and the Emacs developers, it is
606decided to include ERC in Emacs.
607
608@item 2006
609
610ERC 5.1 is released.
611
612@end itemize
613
614@node Concept Index, , History, Top
615@comment node-name, next, previous, up
616@unnumbered Index
617
618@printindex cp
619
620@bye
621
622@ignore
623 arch-tag: cf9cfaff-fc12-4297-ad15-ec2493002b1e
624@end ignore
diff --git a/man/faq.texi b/man/faq.texi
index b34a4d4ae12..95b79a86af6 100644
--- a/man/faq.texi
+++ b/man/faq.texi
@@ -1146,7 +1146,7 @@ operation on X. Mouse wheel support is now enabled by default.
1146 1146
1147@cindex New modes 1147@cindex New modes
1148Many new modes and packages have been included in Emacs, such as Leim, 1148Many new modes and packages have been included in Emacs, such as Leim,
1149Calc, Tramp and URL, as well as IDO, CUA, rcirc, conf-mode, 1149Calc, Tramp and URL, as well as IDO, CUA, rcirc, ERC, conf-mode,
1150python-mode, table, tumme, SES, ruler, Flymake, Org, etc. 1150python-mode, table, tumme, SES, ruler, Flymake, Org, etc.
1151 1151
1152@cindex Documentation 1152@cindex Documentation
diff --git a/man/makefile.w32-in b/man/makefile.w32-in
index ba5435c9585..a6d77de7d11 100644
--- a/man/makefile.w32-in
+++ b/man/makefile.w32-in
@@ -42,7 +42,7 @@ INFO_TARGETS = $(infodir)/emacs $(infodir)/emacs-xtra $(infodir)/ccmode \
42 $(infodir)/woman $(infodir)/eshell $(infodir)/org \ 42 $(infodir)/woman $(infodir)/eshell $(infodir)/org \
43 $(infodir)/url $(infodir)/speedbar $(infodir)/tramp \ 43 $(infodir)/url $(infodir)/speedbar $(infodir)/tramp \
44 $(infodir)/ses $(infodir)/smtpmail $(infodir)/flymake \ 44 $(infodir)/ses $(infodir)/smtpmail $(infodir)/flymake \
45 $(infodir)/newsticker $(infodir)/rcirc 45 $(infodir)/newsticker $(infodir)/rcirc $(infodir)/erc
46DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \ 46DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
47 ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \ 47 ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
48 gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \ 48 gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
@@ -50,7 +50,7 @@ DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
50 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \ 50 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
51 pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \ 51 pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
52 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \ 52 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
53 newsticker.dvi emacs-xtra.dvi rcirc.dvi 53 newsticker.dvi emacs-xtra.dvi rcirc.dvi erc.dvi
54INFOSOURCES = info.texi 54INFOSOURCES = info.texi
55 55
56# The following rule does not work with all versions of `make'. 56# The following rule does not work with all versions of `make'.
@@ -336,6 +336,11 @@ $(infodir)/rcirc: rcirc.texi
336rcirc.dvi: rcirc.texi 336rcirc.dvi: rcirc.texi
337 $(ENVADD) $(TEXI2DVI) $(srcdir)/rcirc.texi 337 $(ENVADD) $(TEXI2DVI) $(srcdir)/rcirc.texi
338 338
339$(infodir)/erc: erc.texi
340 $(MAKEINFO) erc.texi
341erc.dvi: erc.texi
342 $(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi
343
339mostlyclean: 344mostlyclean:
340 - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.* 345 - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
341 346