1 ;;; liece-vars.el --- Customization.
2 ;; Copyright (C) 1998-2000 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
7 ;; Keywords: IRC, liece
9 ;; This file is part of Liece.
11 ;; This program 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)
16 ;; This program 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.
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., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
33 (require 'liece-compat)
34 (require 'liece-globals))
36 ;; User modifiable variables.
38 "liece specific customize group")
40 (defgroup liece-vars nil
41 "liece user customizable variables"
46 (defcustom liece-saved-forms
50 liece-channel-buffer-mode
51 liece-nick-buffer-mode
53 "Variables whose values are saved via command liece-command-save-vars."
57 (defgroup liece-look nil
63 (defcustom liece-command-window-height 4
64 "How large should command window be on startup."
68 (defcustom liece-truncate-partial-width-windows t
69 "If non-nil, truncate lines in splitting windows such as others buffer."
73 (defcustom liece-use-full-window t
74 "If non-nil, IRCHAT will use whole Emacs window."
78 (defcustom liece-display-frame-title t
79 "If non-nil, IRCHAT displays channel information on frame title."
83 (defcustom liece-tab-stop-list '(2 4 6 8 10 12 14 16)
84 "List of tab stop positions in dialogue buffer."
85 :type '(repeat integer)
88 (defcustom liece-icon-directory nil
89 "Normal position of liece icons."
93 (defcustom liece-nick-image-alist
94 '((?@ . "ball.red.xpm")
95 (? . "ball.blank.xpm")
96 (?+ . "ball.gray.xpm"))
97 "Normal and deformed faces for operators and voices."
98 :type '(repeat (list (character :tag "Mark")
99 (string :tag "Image")))
102 (defcustom liece-want-traditional nil
103 "Do we want /commands."
107 (defcustom liece-command-window-on-top nil
108 "If non-nil, the command window will be put at the top of the screen."
112 (defcustom liece-one-buffer-mode nil
113 "When non-nil, liece will put up only a dialogue buffer.
114 Useful for those (perverts) who use 24 line terminals."
118 (defcustom liece-display-status-on-channel-indicator nil
119 "When non-nil, liece will display channel topic on modeline."
123 (defcustom liece-directory "~/.liece"
124 "Where to look for data files."
128 (defcustom liece-variables-file (expand-file-name "init.el" liece-directory)
129 "Where to look for variables. Helps to remove clutter from your .emacs.
130 This feature is most likely to dissappear in near future. The preferred
131 way is to put liece variables on .emacs or file loaded from there."
135 (defcustom liece-variables-files
136 (list liece-variables-file)
137 "Where to look for variables. Helps to remove clutter from your .emacs.
138 This feature is most likely to dissappear in near future. The preferred
139 way is to put liece variables on .emacs or file loaded from there."
140 :type '(repeat (file :tag "Initialization File"))
144 (defgroup liece-server nil
150 (defgroup liece-channel nil
156 (define-widget 'liece-service-spec 'radio
157 "Edit service spec entries"
158 :convert-widget 'liece-service-spec-convert)
160 (defun liece-service-spec-convert (widget)
161 (widget-put widget :args '((integer :tag "Port Number")
162 (string :tag "Name")))
165 (define-widget 'liece-server-spec 'repeat
166 "Edit server spec entries"
167 :match (lambda (widget value)
172 (or (stringp (cdr entry))
173 (listp (cdr entry))))
175 :convert-widget 'liece-server-spec-convert)
177 (defun liece-server-spec-convert (widget)
178 (let* ((host '(const :format "" :value :host))
179 (service '(const :format "" :value :service))
181 (` (group :inline t (, host) (string :tag "Host"))))
183 (` (group :inline t (, service) liece-service-spec)))
187 (radio (string :tag "Host")
188 (list (, host) (, service))))))
189 (args (` ((, spec)))))
190 (widget-put widget :args args)
193 (defcustom liece-server-alist
194 '(("WIDE Project Kyoto NOC, Japan" . "irc.kyoto.wide.ad.jp")
195 ("WIDE Project Tokyo NOC, Japan" . "irc.tokyo.wide.ad.jp")
196 ("TDI RCAC / 6660" :host "irc.rcac.tdi.co.jp" :service 6660)
197 ("TDI RCAC / 6661" :host "irc.rcac.tdi.co.jp" :service 6661)
198 ("TDI RCAC / 6662" :host "irc.rcac.tdi.co.jp" :service 6662)
199 ("TDI RCAC / 6663" :host "irc.rcac.tdi.co.jp" :service 6663)
200 ("TDI RCAC / 6664" :host "irc.rcac.tdi.co.jp" :service 6664)
201 ("TDI RCAC / 6665" :host "irc.rcac.tdi.co.jp" :service 6665)
202 ("TDI RCAC / 6666" :host "irc.rcac.tdi.co.jp" :service 6666)
203 ("TDI RCAC" . "irc.rcac.tdi.co.jp")
204 ("TDI RCAC, 6Bone" . "irc6.rcac.tdi.co.jp")
205 ("RACE, University of Tokyo" . "irc.race.u-tokyo.ac.jp")
206 ("Hokkaido University, Sapporo, Japan" . "irc.huie.hokudai.ac.jp")
207 ("KARRN Hakozaki NOC" . "irc.karrn.ad.jp")
208 ("Tohoku University, Japan" . "irc.tohoku.ac.jp")
209 ("DTI, Akasaka Tokyo, Japan" . "irc.dti.ne.jp"))
210 "IRC server assoc-list which is used for input IRC server."
211 :type 'liece-server-spec
212 :group 'liece-server)
214 (defcustom liece-server (or (getenv "IRCSERVER") nil)
215 "Name of the host running the IRC server.
216 Value initialized from the IRCSERVER environment variable if one is set"
218 :group 'liece-server)
220 (defcustom liece-service
221 (let ((ircport-env (getenv "IRCPORT")))
223 (if (> (string-to-int ircport-env) 0)
224 (string-to-int ircport-env)
227 "IRC service name or (port) number."
228 :type 'liece-service-spec
229 :group 'liece-server)
231 (defcustom liece-my-userhost nil
232 "You can explicitly indicate own hostname here."
233 :type '(radio (string :tag "Hostname")
234 (const :tag "Autodetect" nil))
235 :group 'liece-server)
237 (defcustom liece-password (or (getenv "IRCPASSWORD") nil)
238 "Your password when connecting to server."
239 :type '(radio (string :tag "Password")
240 (const :tag "No" nil))
241 :group 'liece-server)
243 (defcustom liece-name (or (getenv "IRCNAME") (user-real-login-name))
244 "The nickname you want to use in IRC.
245 Default is the environment variable IRCNICK, or your login name."
247 :group 'liece-server)
249 (defcustom liece-nickname (or (getenv "IRCNICK") (user-real-login-name))
250 "The nickname you want to use in IRC.
251 Default is the environment variable IRCNICK, or your login name."
253 :group 'liece-server)
255 (defcustom liece-nick-max-length 9
256 "Maximum length of the nickname."
258 :group 'liece-server)
260 (defvar liece-real-nickname nil)
262 (defcustom liece-startup-channel nil
263 "The channel to join automatically at startup.
264 If nil, do not join any channel."
265 :type '(radio (string :tag "Channels")
267 :group 'liece-channel)
269 (defcustom liece-startup-channel-list nil
270 "The channel list to join automatically at startup.
271 If nil, do not join any channel."
272 :type '(repeat (string :tag "Startup Channel"))
273 :group 'liece-channel)
275 (defcustom liece-auto-join-partner t
276 "Whether join automatically at arriving private message."
278 :group 'liece-channel)
280 (defcustom liece-reconnect-automagic nil
281 "Automatic reconnection, default is disabled."
283 :group 'liece-server)
285 (defcustom liece-ask-for-nickname nil
286 "Ask for nickname if liece was entered with \\[universal-argument]."
288 :group 'liece-server)
290 (defcustom liece-ask-for-password nil
291 "Ask for password when connecting to server."
293 :group 'liece-server)
295 (defcustom liece-ask-for-channel-password nil
296 "Ask for channel password when joining channel with password."
298 :group 'liece-server)
300 (defcustom liece-reconnect-with-password nil
301 "Auto recconect to server with password after incorrect password."
303 :group 'liece-server)
305 (defcustom liece-grow-tail "_"
306 "Add liece-grow-tail to nick when reconnecting.
307 Otherwise you might get killed again if automagic reconnect is too fast."
309 :group 'liece-server)
311 (defcustom liece-auto-iterate-nick nil
312 "When nickname has already been in use, grow-tail automagically."
314 :group 'liece-server)
316 (defvar liece-after-registration nil
317 "After my registration.")
319 (defvar liece-status-message-string nil)
321 (defvar liece-channel-unread-list nil)
324 (defgroup liece-hook nil
330 (defcustom liece-command-mode-hook nil
331 "A hook for IRCHAT command mode."
335 (defcustom liece-dialogue-mode-hook nil
336 "A hook for IRCHAT dialogue mode."
340 (defcustom liece-others-mode-hook nil
341 "A hook for IRCHAT others mode."
345 (defcustom liece-channel-mode-hook nil
346 "A hook for IRCHAT Channel mode."
350 (defcustom liece-nick-mode-hook nil
351 "A hook for IRCHAT nick mode."
355 (defcustom liece-exit-hook nil
356 "A hook executed when signing off IRC."
360 (defcustom liece-before-kill-emacs-hook nil
361 "A hook executed when exitting Emacs."
366 (defcustom liece-channel-buffer-mode nil
367 "When non-nil, liece will display a channel buffer."
371 (defcustom liece-channel-window-height-percent 63
372 "How large percent should Current channel window be on startup."
376 (defcustom liece-default-beep nil
377 "If non nil, channel buffer local beep flag is on at starting."
381 (defcustom liece-default-freeze nil
382 "If non nil, channel buffer local freeze flag is on at starting."
386 (defcustom liece-default-own-freeze nil
387 "If non nil, channel buffer local own freeze flag is on at starting."
391 (defcustom liece-default-channel-binding nil
392 "The channel list to bind the channel number when joining."
393 :type '(repeat (radio (string :tag "Bound Channel")
395 :group 'liece-channel)
397 (defcustom liece-default-partner-binding nil
398 "The chat partner list to bind the partner's number."
399 :type '(repeat (radio (string :tag "Bound Partner")
401 :group 'liece-partner)
404 (defcustom liece-nick-buffer-mode nil
405 "When non-nil, liece will display a nick list buffer."
409 (defcustom liece-nick-window-width-percent 18
410 "How large percent should Current nick list window be on startup."
414 (defcustom liece-nick-window-auto-hide t
415 "Hide nick window in priv buffer automatically."
419 ;; Channel list buffer.
420 (defcustom liece-channel-list-buffer-mode nil
421 "When non-nil, liece will display a channel list buffer."
425 (defcustom liece-channel-list-window-width-percent 18
426 "How large percent should Current channel list window be on startup."
431 (defcustom liece-highlight-mode nil
432 "If non nil, IRC buffer is highlighted by specific rule."
434 :group 'liece-highlight)
436 (defcustom liece-highlight-pattern "$^"
437 "If non nil, this pattern used for user defined highlight rule."
438 :type '(regexp :tag "Highlighting Pattern")
439 :group 'liece-highlight)
442 (defgroup liece-dcc nil
448 (defcustom liece-dcc-program "ldcc"
449 "Name of the external dcc-program.
450 Current version takes the one which is earlier in path \(if many\)."
451 :type '(file :tag "DCC program path")
454 (defcustom liece-dcc-directory "~/tmp"
455 "Directory where liece-dcc puts its files."
459 (defcustom liece-dcc-port 0
460 "Default port for DCC operations."
464 (defcustom liece-dcc-resolve-server nil
465 "Resolve IRC server FQDN with external DCC command."
469 ;; Prefix strings for various messages.
470 (defgroup liece-prefix nil
471 "Various message prefix"
476 (defgroup liece-prefix-string nil
477 "Various prefix string"
480 :group 'liece-prefix)
482 (defcustom liece-defected-message-prefix ""
483 "Prefix to attach before the defected crypt message."
485 :group 'liece-prefix-string)
487 (defcustom liece-suspicious-message-prefix ""
488 "Prefix to attach before the suspicious crypt message."
490 :group 'liece-prefix-string)
492 (defcustom liece-change-prefix "*** Change: "
493 "String to add before changing messages."
495 :group 'liece-prefix-string)
497 (defcustom liece-notice-prefix "*** Notice: "
498 "String to add before any notice message."
500 :group 'liece-prefix-string)
502 (defcustom liece-broadcast-prefix "*** Broadcast: "
503 "String to add before any Broadcast message."
505 :group 'liece-prefix-string)
507 (defcustom liece-wallops-prefix "*** Notice: "
508 "String to add before any WALLOPS message."
510 :group 'liece-prefix-string)
512 (defcustom liece-error-prefix "*** Error: "
513 "String to add before any ERROR message."
515 :group 'liece-prefix-string)
517 (defcustom liece-info-prefix "*** Info: "
518 "String to add before any informational message."
520 :group 'liece-prefix-string)
522 (defcustom liece-timestamp-prefix "*** Time: "
523 "String to add before any timestamp message."
525 :group 'liece-prefix-string)
527 (defcustom liece-client-prefix "*** Client: "
528 "String to add before any CTCP message."
530 :group 'liece-prefix-string)
532 (defcustom liece-dcc-prefix "*** DCC: "
533 "String to add before any DCC message."
535 :group 'liece-prefix-string)
537 (defcustom liece-time-prefix-regexp "[0-9][0-9]:[0-9][0-9] "
538 "Time prefix regexp."
540 :group 'liece-prefix)
542 (defcustom liece-display-time t
543 "If non-nil, print time prefix on each line in channel buffer."
545 :group 'liece-prefix)
547 (defcustom liece-display-prefix-tag nil
548 "If non-nil, print prefix tag on each line in channel buffer."
550 :group 'liece-prefix)
552 (defcustom liece-generic-prefix-tag-regexp "\\*\\*\\* \\([^:]+: \\)"
553 "Regular expression for generic prefix tag."
555 :group 'liece-prefix)
558 (defcustom liece-blink-parens nil
559 "Should we blink matching parenthesis in liece command buffer?"
563 (defcustom liece-show-wallops t
564 "Show wallops messages if usermode +ws."
568 (defcustom liece-ignore-extra-notices t
569 "Don't show any notice unless they come from the local server."
573 (defcustom liece-shorten-kills t
574 "Shorten KILL messages to about one line."
578 (defcustom liece-ignore-changes nil
579 "Ignore changes? Good in topic-wars/link troubles."
583 (defcustom liece-ignore-fakes nil
584 "If non nil, ignore fake notices if receiving them."
588 (defcustom liece-signoff-message nil
589 "Default signoff message."
590 :type '(radio (string :tag "Signoff message"))
593 (defcustom liece-away-message ""
594 "Default away message."
598 (defcustom liece-beep-on-bells 'always
599 "If non-nil, and the IRC dialogue buffer is not selected in a window,
600 an IRC message arriving containing a bell character, will cause you
602 If value is 'always, an arriving bell will always cause a beep (or flash)."
603 :type '(radio (const :tag "Always" always) (const :tag "No" nil))
606 (defcustom liece-beep-when-invited nil
607 "If non-nil, beep when invited."
611 (defcustom liece-beep-when-privmsg nil
612 "If non-nil, beep when received privmsg."
616 (defcustom liece-beep-words-list nil
617 "This list used for user defined beep rules."
618 :type '(repeat (string :tag "Beep Rules List"))
621 (defcustom liece-system-fqdname (system-name)
622 "The fully qualified domain name of the system.
623 Default is what (system-name) returns."
627 (defcustom liece-gather-channel-modes t
628 "Gather channel modes when joining channels."
632 (defcustom liece-use-x-face nil
633 "Display X-Face in dialogue buffer."
637 ;; Send/Receive files.
638 (defcustom liece-file-accept nil
639 "Do we accept files."
643 (defcustom liece-file-confirm-save nil
644 "Do we want confirmation on saving files."
649 (defgroup liece-ctcp nil
655 (defcustom liece-ctcp-userinfo "No user information given."
656 "Userinfo message given to anyone asking."
660 (defcustom liece-ctcp-x-face ""
661 "X-Face message given to anyone asking. Proper form is \"X-Face: ....\"."
665 (static-when (featurep 'xemacs)
666 (define-obsolete-variable-alias 'liece-client-userinfo
667 'liece-ctcp-userinfo)
668 (define-obsolete-variable-alias 'liece-client-x-face
671 (defcustom liece-timers
672 '((liece-command-poll-names liece-poll-names-interval)
673 (liece-command-keepalive liece-keepalive-interval)
674 (liece-command-poll-friends liece-poll-friends-interval))
675 "Symbol name to store timer, timer-function and timer-interval."
677 :group 'liece-server)
679 (defcustom liece-friends nil
680 "Friends to be checked consequently."
681 :type '(repeat (string :tag "Nick"))
684 (defcustom liece-display-friends-function 'liece-303-display-friends
685 "Function to display friends status."
689 (defcustom liece-poll-friends-interval 30
690 "Interval on seconds the existence of friends."
692 (integer :tag "Polling Interval in Seconds")
693 (const :tag "No" nil))
694 :group 'liece-server)
696 (defcustom liece-keepalive-interval nil
697 "Interval on seconds the existence of server connection is checked."
699 (integer :tag "Seconds"
700 :doc "Connection Interval in Seconds")
701 (const :tag "No" nil))
702 :group 'liece-server)
704 (defcustom liece-poll-names-interval nil
705 "Interval the names are polled from server."
707 (integer :tag "Seconds"
708 :doc "NAMES Polling Interval in Seconds")
709 (const :tag "No" nil))
710 :group 'liece-server)
712 (defcustom liece-timestamp-interval (* 60 10)
713 "Interval in seconds between timestamps in dialogue-buffer, nil for none."
715 (integer :tag "Seconds"
716 :doc "Timestamp Interval in Seconds")
718 :group 'liece-server)
720 (defcustom liece-connection-timeout 60
721 "Default timeout interval."
723 :group 'liece-server)
725 (defcustom liece-timestamp-format (concat liece-timestamp-prefix "%s")
726 "Format-string for timestamp."
728 :group 'liece-format-string)
730 ;; Conversions: Not used.
731 (defcustom liece-send-convert-list nil
732 "Convert characters before sending to server."
733 :type '(repeat (character :tag "Character"
734 :doc "Convert Character"))
737 (defcustom liece-receive-convert-list nil
738 "Convert characters after receiving from server."
739 :type '(repeat (character :tag "Character"
740 :doc "Convert Character"))
744 (defgroup liece-ignore nil
750 (defcustom liece-kill-nickname nil
751 "List of nicknames to be ignored.
752 Messages from these people won't be displayed."
753 :type '(repeat (string :tag "Nick" :doc "Ignore Nick"))
754 :group 'liece-ignore)
756 (defcustom liece-kill-realname nil
757 "List of real names to be ignored.
758 Messages from them won't be displayed."
759 :type '(repeat (string :tag "Realname" :doc "Ignore Realname"))
760 :group 'liece-ignore)
762 (defcustom liece-kill-logon nil
763 "List of logon names (user@host.dom.ain) to be ignored.
764 Messages from them won't be displayed."
765 :type '(repeat (string :tag "Logon" :doc "Ignore Logon Name"))
766 :group 'liece-ignore)
769 (defcustom liece-no-ignore-buffers nil
770 "A list of buffers that don't adhere to ignore-list."
771 :type '(repeat (string :tag "Buffer" :doc "Don't Ignore Buffer Names"))
772 :group 'liece-ignore)
774 (define-widget 'liece-ignore-spec 'repeat
775 "Edit server spec entries"
776 :convert-widget 'liece-ignore-spec-convert)
778 (defun liece-ignore-spec-convert (widget)
781 (string :tag "Type" :doc "Match for messagetype")
785 (string :tag "Match" :doc "Match for string-in-message")
788 '(function :doc "Function whose return value is ignore info"))
790 '(function :doc "Function whose return value is ignore user list"))
792 '(repeat :tag "Name" (string :doc "Ignore user name")))
794 (` (list :value (nil nil)
795 (choice :tag "Message"
796 (cons (, type) (, match)) (const nil) (, info-func))
797 (choice :tag "User" (const nil) (, user-func) (, name)))))
798 (args (` ((, spec)))))
799 (widget-put widget :args args)
802 (defcustom liece-ignore-list nil
803 "A list of buffers that don't adhere to ignore-list."
804 :type 'liece-ignore-spec
805 :group 'liece-ignore)
807 (defcustom liece-compress-changes t
808 "Set to t if we want instant compressed messages in the old format."
812 (defcustom liece-compress-treshold 1
813 "Number of lines to search back for a previous matching join/part/quit/mode."
817 (defcustom liece-compress-mode-length 3
818 "Number of mode compression length."
822 (defcustom liece-buffer-max-size 4242424
823 "Maximum size (in bytes) of any liece buffer."
827 (defcustom liece-buffer-default-size 4042424
828 "Size to shrink buffer if it grows too big."
832 (defcustom liece-buffer-check-interval (* 60 10)
833 "Interval between `buffer-size' checks."
837 (static-when (featurep 'xemacs)
838 (define-obsolete-variable-alias 'liece-buffer-maxsize
839 'liece-buffer-max-size)
840 (define-obsolete-variable-alias 'liece-buffer-defsize
841 'liece-buffer-default-size)
842 (define-obsolete-variable-alias 'liece-checkbuffer-interval
843 'liece-buffer-check-interval))
845 (defcustom liece-private-window-height 4
846 "How tall is the window for private messages when shown."
850 (defcustom liece-format-time-function
851 'liece-compose-time-string
852 "Function to convert `current-time-string' to the human readable form.
853 If you like to have the short format, set this to nil or to a
854 funtion (defun my-format (s) s)."
858 (defcustom liece-keep-buffers t
859 "When (re)starting IRC, erase contents of old buffers."
863 (defcustom liece-scroll-step nil
864 "The number of lines to try scrolling a window by when point moves out."
865 :type '(radio (integer :tag "Scroll Step")
869 (defcustom liece-swap-private nil
870 "When showing private is it between under dialogue or not."
874 (defcustom liece-buffer-preferences
876 (cons ".*" liece-D-buffer))
877 "List of lists that contain regexp to match and `buffer-list' to insert.
880 (cons \"#report\" (list \"*report-buffer*\"))
881 (cons \".*\" liece-D-buffer))
882 would cause messages from and to channel #report to be displayed on
883 buffer named *report-buffer* and all other messages are displayed on
885 :type '(repeat (cons (string :tag "Channel Name")
886 (list (variable :tag "Buffe or Name"))))
889 (defcustom liece-channel-conversion-map nil
890 "The map of channel conversion."
891 :type '(repeat (cons (string :tag "Channel Name")
892 (string :tag "Channel Name (After Conversion)")))
895 (defcustom liece-channel-conversion-default-mask "*.jp"
896 "The default mask of channel conversion."
900 (defcustom liece-channel-id-length 5
901 "Length of channel ID for ! channels."
905 (defcustom liece-insert-environment-version nil
906 "If non-nil, display version description of current environment."
910 (provide 'liece-vars)
912 ;;; liece-vars.el ends here