77795b788b3c734eace690c4aa70856a3434586c
[packages] / xemacs-packages / zenirc / src / zenirc-example.el
1 ;;;
2 ;;;
3 ;;; zenirc-example.el --- Example customizations for zenirc.el
4
5 ;;; Copyright (C) 1993, 1994 Ben A. Mesander
6 ;;; Copyright (C) 1993, 1994, 1996, 1997, 1998 Per Persson
7
8 ;;; Author: Ben A. Mesander <ben@gnu.ai.mit.edu>
9 ;;;         Per Persson <pp@sno.pp.se>
10 ;;; Maintainer: Per Persson <pp@sno.pp.se>
11 ;;; Keywords: extensions
12 ;;; Created: 1993/06/03
13
14 ;;; This program is free software; you can redistribute it and/or modify
15 ;;; it under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 2, or (at your option)
17 ;;; any later version.
18 ;;;
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with this program; if not, you can either send email to this
26 ;;; program's maintainer or write to: The Free Software Foundation,
27 ;;; Inc.; 675 Massachusetts Avenue; Cambridge, MA 02139, USA.
28
29 ;;; Commentary:
30
31 ;; A good way to use this is to add something like
32 ;; (autoload 'zenirc "/home/pp/.zenirc-example" "Major mode to waste time" t)
33 ;; to your ~/.emacs file. Then edit and copy this file there. If you do that
34 ;; you also need to uncomment the last line of this file.
35
36 ;; if the autoload says ".zenirc-example", the file needs to be named
37 ;; ".zenirc-example.el", this is probably the best way for you to name
38 ;; it. (sure, go ahead and rename it, don't blame me).
39
40 ;; Also take a look on all the different scripts not mentioned in this file,
41 ;; they might give you something you'll love.
42
43 ;;; Code:
44
45 ;; this is a list of IRC servers you use
46 ;; it consists of servername, portnumber, password, nickname, username
47 (setq zenirc-server-alist 
48       '(("irc.funet.fi")
49         ("cs-pub.bu.edu" 6666)
50         ("irc.stealth.net" 6667 nil "ben" "oedipus rpc.rexd")))
51
52 ;; this is what you reply to CTCP USERINFO
53 (setq zenirc-userinfo "Oink.")
54
55 ;; this is a list of annoying things to ignore. This list ignores
56 ;; messages from nickserv, anything with the word "fnord" in it,
57 ;; messages from the major dweeb craig and everything with more then
58 ;; four CTCPs in it.
59 (setq zenirc-ignore-list 
60       '("^:NickServ!Nickserv@hpsystem2.informatik.tu-muenchen.de" "fnord"
61         "^:craig!craig@netsys1.netsys.com"     
62         "\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a[^\C-a]*\C-a"))
63
64 ;; zenirc can beep when it notices something, 
65 ;; nil -> never beep
66 ;; t -> beep when message not seen
67 ;; 'always -> beep on all signals
68 (setq zenirc-beep-on-signal nil)
69
70 ;; with zenirc-beep-on-signal turned on, 
71 ;; this will make zenirc beep when it sees a ^G ala ircII and when you recieve
72 ;; a private PRIVMSG
73 ;(setq zenirc-signal-list '("\a
74 ;                            "^\\([^ ]\\)* PRIVMSG [^#&+]\\([^ ]\\)* :"))
75
76 ;; this is how you want ZenIRC to send confirmations
77 ;; "nil" is no confirmation
78 ;; "t" is confirmation in buffer
79 ;; "'message" is confirmation in echo area
80 (setq zenirc-send-confirmation t)
81
82 ;; if you want timestamps on PRIVMSG/NOTICE or not
83 ;; with default prefix and suffix it looks like
84 ;;      *ben[13:31]* lets have some fun
85 ;;      <ben#twilight_zone[13:32]> SLUGS AND KNIGHTS! SLUGS AND KNIGTS!
86 (setq zenirc-timestamp nil
87       zenirc-timestamp-prefix "["
88       zenirc-timestamp-suffix "]")
89
90 ;; in ircII, the channelname isn't shown in PRIVMSGs if you're currently
91 ;; talking to the channel, setting zenirc-always-show-channelname to nil
92 ;; gives you the same effect.
93 (setq zenirc-always-show-channelname nil)
94
95 ;; if WHOIS returns no-such-nick, setting this variable to t will make 
96 ;; the client automaticall issue an WHOWAS command
97 (setq zenirc-whowas-on-401 nil)
98
99 ;; setting this variable to t will make ZenIRC remove preceding whitespaces
100 ;; before a command, that is;
101 ;;   /whois omnion
102 ;; will turn in to;
103 ;; /whois omnion
104 ;; but;
105 ;;   oink!
106 ;; will turn in to;
107 ;;   oink!
108 ;; yeah, there's no difference there.
109 (setq zenirc-delete-preceding-whitespaces nil)
110
111 ;; if you want ZenIRC to send out ERRMSG on bogus CTCP queries
112 (setq zenirc-send-ctcp-errmsg-on-unknown t)
113 ;; if you awnt ZenIRC to send out ERRMSG on unbalanced CTCP queries
114 (setq zenirc-send-ctcp-errmsg-on-unbalanced t)
115
116 ;; if you want ZenIRC to tell you when send out CTCP replies
117 (setq zenirc-verbose-ctcp t)
118
119 ;; what ZenIRC replies on CTCP FINGER
120 (setq zenirc-fingerdata
121       (format "%s <%s@%s>" (user-full-name) (user-real-login-name) 
122               (system-name)))
123
124 ;; commandkey in ZenIRC
125 (setq zenirc-command-char ?/)
126
127 ;;; use the following to surpress AWAY info if seen more then once
128
129 ;(load-library "zenirc-away")
130
131 ;;; use the following to make ZenIRC queue commands for you, to get around
132 ;;; stupid flood controls
133
134 ;(load-library "zenirc-command-queue")
135
136 ;;; use the following to have tab-completion in ZenIRC
137
138 ;(load-library "zenirc-complete")
139
140 ;;; use the following to be able to act upon DCC CHAT and DCC SEND requests
141
142 ;(load-library "zenirc-dcc")
143
144 ;;; use the following to make ZenIRC fill incoming messages for you
145
146 ;; if ZenIRC should fill incoming lines
147 ;(setq zenirc-fill-mode t)
148 ;; if ZenIRC should fill outgoing lines
149 ;(setq zenirc-fill-outgoing-mode t)
150 ;; how ZenIRC should fill things
151 ;; (zenirc-wrap-region) adds zenirc-fill-prefix on each line
152 ;(setq zenirc-fill-region-function 'zenirc-wrap-region)
153 ;(setq zenirc-fill-prefix "   ")
154 ;; (zenirc-wrap-region-dynamic) adds spaces at beginning of line, 
155 ;; depending on length of first word
156 ;(setq zenirc-fill-region-function 'zenric-wrap-region-dynamic)
157 ;; (zenirc-wrap-region-static) adds spaces uses zenirc-fill-static 
158 ;; columns to the left to display <nick#channel> and the rest to 
159 ;; actual messages.
160 ;(setq zenirc-fill-region-function 'zenirc-wrap-region-static)
161 ;(setq zenirc-fill-static 26)
162 ;(load-library "zenirc-fill")
163
164 ;;; use the following to make ZenIRC format things like no-other-client 
165 ;;; is able to. the first time a nick is seen, it's shown as 
166 ;;; `nick!user@host'... after the first time it's just shown as `nick'
167 ;;; until the `user@host' part changes.
168
169 ;(load-library "zenirc-format")
170
171 ;;; use the following to get history functions on C-cC-p and C-cC-n
172
173 ;(load-library "zenirc-history")
174
175 ;;; use the following to get an ircII like /ignore command
176
177 ;(load-library "zenirc-ignore")
178
179 ;;; use the following to make ZenIRC output netsplits/netjoins nicer
180
181 ;(load-library "zenirc-netsplit")
182
183 ;;; use the following to get an ircII like /notify command
184
185 ;; a list of notificated people
186 ;(setq zenirc-notify-list 
187 ;      '("oddy" "piker" "flashman"))
188 ;(load-library "zenirc-notify")
189
190 ;;; use the following to make ZenIRC popup buffers when things happen
191
192 ;(load-library "zenirc-popup")
193
194 ;;; use the following if you want ZenIRC to act automatically when it
195 ;;; sees a certain string in a PRIVMSG. if this sounds interesting, read 
196 ;;; the comments in zenirc-trigger.el and take a look at zenirc-yow.el,
197 ;;; zenirc-oink.el, zenirc-meditate.el, zenirc-8ball.el, zenirc-shop.el
198 ;;; and zenirc-fortran.el
199
200 ;(load-library "zenirc-trigger")
201
202 ;; the following is an example of how to do something during initializing a
203 ;; server connection. 001 is the first thing the server sends to a client
204 ;; after the client sends USER and NICK.
205 ;;
206 ;; :pfawww.pp.se 001 Omnion :Welcome to the Internet Relay Network Omnion
207 ;;
208 ;; current code from Eric Prestemon <ecp@io.com>
209
210 (defvar zenirc-startup-channels-alist '(("debian" . "#debian")
211                                         ("uoknor.edu" . nil)
212                                         (".*" . "#perl"))
213   "*Pairs of server and channels.
214 server is a regexp
215 channels is a comma separated string of channels to join during 
216  startup where  nil means none")
217
218 (defun zenirc-startup-join (proc parsedmsg)
219   (let ((channelpairs (copy-alist zenirc-startup-channels-alist)))
220     (while channelpairs
221       (if (string-match (car (car channelpairs)) zenirc-server)
222           (progn
223             (if (cdr (car channelpairs))
224                 (process-send-string proc
225                                      (concat "JOIN " 
226                                              (cdr (car channelpairs)) 
227                                              "\n")))
228             (setq channelpairs nil))
229         (setq channelpairs (cdr channelpairs))))))      
230
231 (zenirc-add-hook 'zenirc-server-001-hook 'zenirc-startup-join)
232
233 ;;
234 ;; the following is an example of adding a new ctcp reply type to zenirc.
235 ;; in this case, it is "BOZOS", which returns a list of people who have
236 ;; been bozotic with me
237 ;;
238
239 ;; create a hook to be called and assign it a default value
240 (defvar zenirc-ctcp-query-BOZOS-hook '(zenirc-ctcp-query-BOZOS))
241
242 (setq zenirc-clientinfo-list
243 '((ACTION . "ACTION contains action descriptions for atmosphere")
244 ;; this is the addition to the default list
245   (BOZOS . "BOZOS returns a list of people who have been bozotic with me")
246   (CLIENTINFO . "CLIENTINFO gives information about available CTCP commands")
247   (ERRMSG . "ERRMSG returns error messages")
248   (PING . "PING returns the arguments it receives")
249   (FINGER . "FINGER shows real name, and login name of user (idle time is not yet implemented in ZenIRC)")
250 ;; sojge sure is a wordy bastard.
251   (SOURCE . "takes 0 arguments and returns a description of where to find the source code of the client. The description is made up out of zero or more lines followed by an end marker. Every line is a CTCP reply with the SOURCE keyword, a space, the name of a FTP-server, a colon, a directory name, a colon, and 0 or more file names. If no file names are given, all the files in the named directory are needed. The end marker contains just the keyword.")
252   (TIME . "TIME tells you the time on the user's host")
253   (USERINFO . "USERINFO returns user settable information")
254   (VERSION . "VERSION shows client type, version, and environment")))
255
256 ;; note addition of BOZOS--------------*****
257 (setq zenirc-clientinfo-string "ACTION BOZOS CLIENTINFO ERRMSG FINGER PING SOURCE TIME USERINFO VERSION :Use CLIENTINFO <COMMAND> to get more specific information")
258
259 ;;
260 ;; this is the handler for a CTCP BOZOS query
261 ;;
262 (defun zenirc-ctcp-query-BOZOS (proc parsedctcp from to)
263   ;; if verbose ctcp is on, tell the user we got the query
264   (if zenirc-verbose-ctcp
265       (zenirc-message 
266        proc 
267        (format "[info] responding to BOZOS query from %s to %s\n" 
268                (zenirc-run-hook 'zenirc-format-nickuserhost-hook from) to)))
269   ;; send a reply to the BOZOS query
270   (process-send-string 
271    proc 
272    (concat "NOTICE  " (zenirc-extract-nick from)
273            " :\C-aBOZOS phone poxav veep noah rmtodd dmarcher lila neil notused laura w jason belladona mycroft amazin CHRISTIAN omnion fn vuori nap\C-a\n")))
274
275 ;; this is the second last line of the file, the next line is the last one
276 (require 'zenirc)