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)
322 (defgroup liece-hook nil
328 (defcustom liece-command-mode-hook nil
329 "A hook for IRCHAT command mode."
333 (defcustom liece-dialogue-mode-hook nil
334 "A hook for IRCHAT dialogue mode."
338 (defcustom liece-others-mode-hook nil
339 "A hook for IRCHAT others mode."
343 (defcustom liece-channel-mode-hook nil
344 "A hook for IRCHAT Channel mode."
348 (defcustom liece-nick-mode-hook nil
349 "A hook for IRCHAT nick mode."
353 (defcustom liece-exit-hook nil
354 "A hook executed when signing off IRC."
358 (defcustom liece-before-kill-emacs-hook nil
359 "A hook executed when exitting Emacs."
364 (defcustom liece-channel-buffer-mode nil
365 "When non-nil, liece will display a channel buffer."
369 (defcustom liece-channel-window-height-percent 63
370 "How large percent should Current channel window be on startup."
374 (defcustom liece-default-freeze nil
375 "If non nil, channel buffer local freeze flag is on at starting."
379 (defcustom liece-default-own-freeze nil
380 "If non nil, channel buffer local own freeze flag is on at starting."
384 (defcustom liece-default-channel-binding nil
385 "The channel list to bind the channel number when joining."
386 :type '(repeat (radio (string :tag "Bound Channel")
388 :group 'liece-channel)
390 (defcustom liece-default-partner-binding nil
391 "The chat partner list to bind the partner's number."
392 :type '(repeat (radio (string :tag "Bound Partner")
394 :group 'liece-partner)
397 (defcustom liece-nick-buffer-mode nil
398 "When non-nil, liece will display a nick list buffer."
402 (defcustom liece-nick-window-width-percent 18
403 "How large percent should Current nick list window be on startup."
407 (defcustom liece-nick-window-auto-hide t
408 "Hide nick window in priv buffer automatically."
412 ;; Channel list buffer.
413 (defcustom liece-channel-list-buffer-mode nil
414 "When non-nil, liece will display a channel list buffer."
418 (defcustom liece-channel-list-window-width-percent 18
419 "How large percent should Current channel list window be on startup."
424 (defcustom liece-highlight-mode nil
425 "If non nil, IRC buffer is highlighted by specific rule."
427 :group 'liece-highlight)
429 (defcustom liece-highlight-pattern "$^"
430 "If non nil, this pattern used for user defined highlight rule."
431 :type '(regexp :tag "Highlighting Pattern")
432 :group 'liece-highlight)
435 (defgroup liece-dcc nil
441 (defcustom liece-dcc-program "ldcc"
442 "Name of the external dcc-program.
443 Current version takes the one which is earlier in path \(if many\)."
444 :type '(file :tag "DCC program path")
447 (defcustom liece-dcc-directory "~/tmp"
448 "Directory where liece-dcc puts its files."
452 (defcustom liece-dcc-port 0
453 "Default port for DCC operations."
457 (defcustom liece-dcc-resolve-server nil
458 "Resolve IRC server FQDN with external DCC command."
462 ;; Prefix strings for various messages.
463 (defgroup liece-prefix nil
464 "Various message prefix"
469 (defgroup liece-prefix-string nil
470 "Various prefix string"
473 :group 'liece-prefix)
475 (defcustom liece-defected-message-prefix ""
476 "Prefix to attach before the defected crypt message."
478 :group 'liece-prefix-string)
480 (defcustom liece-suspicious-message-prefix ""
481 "Prefix to attach before the suspicious crypt message."
483 :group 'liece-prefix-string)
485 (defcustom liece-change-prefix "*** Change: "
486 "String to add before changing messages."
488 :group 'liece-prefix-string)
490 (defcustom liece-notice-prefix "*** Notice: "
491 "String to add before any notice message."
493 :group 'liece-prefix-string)
495 (defcustom liece-broadcast-prefix "*** Broadcast: "
496 "String to add before any Broadcast message."
498 :group 'liece-prefix-string)
500 (defcustom liece-wallops-prefix "*** Notice: "
501 "String to add before any WALLOPS message."
503 :group 'liece-prefix-string)
505 (defcustom liece-error-prefix "*** Error: "
506 "String to add before any ERROR message."
508 :group 'liece-prefix-string)
510 (defcustom liece-info-prefix "*** Info: "
511 "String to add before any informational message."
513 :group 'liece-prefix-string)
515 (defcustom liece-timestamp-prefix "*** Time: "
516 "String to add before any timestamp message."
518 :group 'liece-prefix-string)
520 (defcustom liece-client-prefix "*** Client: "
521 "String to add before any CTCP message."
523 :group 'liece-prefix-string)
525 (defcustom liece-dcc-prefix "*** DCC: "
526 "String to add before any DCC message."
528 :group 'liece-prefix-string)
530 (defcustom liece-time-prefix-regexp "[0-9][0-9]:[0-9][0-9] "
531 "Time prefix regexp."
533 :group 'liece-prefix)
535 (defcustom liece-display-time t
536 "If non-nil, print time prefix on each line in channel buffer."
538 :group 'liece-prefix)
540 (defcustom liece-display-prefix-tag nil
541 "If non-nil, print prefix tag on each line in channel buffer."
543 :group 'liece-prefix)
545 (defcustom liece-generic-prefix-tag-regexp "\\*\\*\\* \\([^:]+: \\)"
546 "Regular expression for generic prefix tag."
548 :group 'liece-prefix)
551 (defcustom liece-blink-parens nil
552 "Should we blink matching parenthesis in liece command buffer?"
556 (defcustom liece-show-wallops t
557 "Show wallops messages if usermode +ws."
561 (defcustom liece-ignore-extra-notices t
562 "Don't show any notice unless they come from the local server."
566 (defcustom liece-shorten-kills t
567 "Shorten KILL messages to about one line."
571 (defcustom liece-ignore-changes nil
572 "Ignore changes? Good in topic-wars/link troubles."
576 (defcustom liece-ignore-fakes nil
577 "If non nil, ignore fake notices if receiving them."
581 (defcustom liece-signoff-message nil
582 "Default signoff message."
583 :type '(radio (string :tag "Signoff message"))
586 (defcustom liece-away-message ""
587 "Default away message."
591 (defcustom liece-beep-on-bells 'always
592 "If non-nil, and the IRC dialogue buffer is not selected in a window,
593 an IRC message arriving containing a bell character, will cause you
595 If value is 'always, an arriving bell will always cause a beep (or flash)."
596 :type '(radio (const :tag "Always" always) (const :tag "No" nil))
599 (defcustom liece-system-fqdname (system-name)
600 "The fully qualified domain name of the system.
601 Default is what (system-name) returns."
605 (defcustom liece-gather-channel-modes t
606 "Gather channel modes when joining channels."
610 (defcustom liece-use-x-face nil
611 "Display X-Face in dialogue buffer."
615 ;; Send/Receive files.
616 (defcustom liece-file-accept nil
617 "Do we accept files."
621 (defcustom liece-file-confirm-save nil
622 "Do we want confirmation on saving files."
627 (defgroup liece-ctcp nil
633 (defcustom liece-ctcp-userinfo "No user information given."
634 "Userinfo message given to anyone asking."
638 (defcustom liece-ctcp-x-face ""
639 "X-Face message given to anyone asking. Proper form is \"X-Face: ....\"."
643 (static-when (featurep 'xemacs)
644 (define-obsolete-variable-alias 'liece-client-userinfo
645 'liece-ctcp-userinfo)
646 (define-obsolete-variable-alias 'liece-client-x-face
649 (defcustom liece-timers
650 '((liece-command-poll-names liece-poll-names-interval)
651 (liece-command-keepalive liece-keepalive-interval)
652 (liece-command-poll-friends liece-poll-friends-interval))
653 "Symbol name to store timer, timer-function and timer-interval."
655 :group 'liece-server)
657 (defcustom liece-friends nil
658 "Friends to be checked consequently."
659 :type '(repeat (string :tag "Nick"))
662 (defcustom liece-display-friends-function 'liece-303-display-friends
663 "Function to display friends status."
667 (defcustom liece-poll-friends-interval 30
668 "Interval on seconds the existence of friends."
670 (integer :tag "Polling Interval in Seconds")
671 (const :tag "No" nil))
672 :group 'liece-server)
674 (defcustom liece-keepalive-interval nil
675 "Interval on seconds the existence of server connection is checked."
677 (integer :tag "Seconds"
678 :doc "Connection Interval in Seconds")
679 (const :tag "No" nil))
680 :group 'liece-server)
682 (defcustom liece-poll-names-interval nil
683 "Interval the names are polled from server."
685 (integer :tag "Seconds"
686 :doc "NAMES Polling Interval in Seconds")
687 (const :tag "No" nil))
688 :group 'liece-server)
690 (defcustom liece-timestamp-interval (* 60 10)
691 "Interval in seconds between timestamps in dialogue-buffer, nil for none."
693 (integer :tag "Seconds"
694 :doc "Timestamp Interval in Seconds")
696 :group 'liece-server)
698 (defcustom liece-connection-timeout 60
699 "Default timeout interval."
701 :group 'liece-server)
703 (defcustom liece-timestamp-format (concat liece-timestamp-prefix "%s")
704 "Format-string for timestamp."
706 :group 'liece-format-string)
708 ;; Conversions: Not used.
709 (defcustom liece-send-convert-list nil
710 "Convert characters before sending to server."
711 :type '(repeat (character :tag "Character"
712 :doc "Convert Character"))
715 (defcustom liece-receive-convert-list nil
716 "Convert characters after receiving from server."
717 :type '(repeat (character :tag "Character"
718 :doc "Convert Character"))
722 (defgroup liece-ignore nil
728 (defcustom liece-kill-nickname nil
729 "List of nicknames to be ignored.
730 Messages from these people won't be displayed."
731 :type '(repeat (string :tag "Nick" :doc "Ignore Nick"))
732 :group 'liece-ignore)
734 (defcustom liece-kill-realname nil
735 "List of real names to be ignored.
736 Messages from them won't be displayed."
737 :type '(repeat (string :tag "Realname" :doc "Ignore Realname"))
738 :group 'liece-ignore)
740 (defcustom liece-kill-logon nil
741 "List of logon names (user@host.dom.ain) to be ignored.
742 Messages from them won't be displayed."
743 :type '(repeat (string :tag "Logon" :doc "Ignore Logon Name"))
744 :group 'liece-ignore)
747 (defcustom liece-no-ignore-buffers nil
748 "A list of buffers that don't adhere to ignore-list."
749 :type '(repeat (string :tag "Buffer" :doc "Don't Ignore Buffer Names"))
750 :group 'liece-ignore)
752 (define-widget 'liece-ignore-spec 'repeat
753 "Edit server spec entries"
754 :convert-widget 'liece-ignore-spec-convert)
756 (defun liece-ignore-spec-convert (widget)
759 (string :tag "Type" :doc "Match for messagetype")
763 (string :tag "Match" :doc "Match for string-in-message")
766 '(function :doc "Function whose return value is ignore info"))
768 '(function :doc "Function whose return value is ignore user list"))
770 '(repeat :tag "Name" (string :doc "Ignore user name")))
772 (` (list :value (nil nil)
773 (choice :tag "Message"
774 (cons (, type) (, match)) (const nil) (, info-func))
775 (choice :tag "User" (const nil) (, user-func) (, name)))))
776 (args (` ((, spec)))))
777 (widget-put widget :args args)
780 (defcustom liece-ignore-list nil
781 "A list of buffers that don't adhere to ignore-list."
782 :type 'liece-ignore-spec
783 :group 'liece-ignore)
785 (defcustom liece-compress-changes t
786 "Set to t if we want instant compressed messages in the old format."
790 (defcustom liece-compress-treshold 1
791 "Number of lines to search back for a previous matching join/part/quit/mode."
795 (defcustom liece-compress-mode-length 3
796 "Number of mode compression length."
800 (defcustom liece-buffer-max-size 4242424
801 "Maximum size (in bytes) of any liece buffer."
805 (defcustom liece-buffer-default-size 4042424
806 "Size to shrink buffer if it grows too big."
810 (defcustom liece-buffer-check-interval (* 60 10)
811 "Interval between `buffer-size' checks."
815 (static-when (featurep 'xemacs)
816 (define-obsolete-variable-alias 'liece-buffer-maxsize
817 'liece-buffer-max-size)
818 (define-obsolete-variable-alias 'liece-buffer-defsize
819 'liece-buffer-default-size)
820 (define-obsolete-variable-alias 'liece-checkbuffer-interval
821 'liece-buffer-check-interval))
823 (defcustom liece-private-window-height 4
824 "How tall is the window for private messages when shown."
828 (defcustom liece-format-time-function
829 'liece-compose-time-string
830 "Function to convert `current-time-string' to the human readable form.
831 If you like to have the short format, set this to nil or to a
832 funtion (defun my-format (s) s)."
836 (defcustom liece-keep-buffers t
837 "When (re)starting IRC, erase contents of old buffers."
841 (defcustom liece-scroll-step nil
842 "The number of lines to try scrolling a window by when point moves out."
843 :type '(radio (integer :tag "Scroll Step")
847 (defcustom liece-swap-private nil
848 "When showing private is it between under dialogue or not."
852 (defcustom liece-buffer-preferences
854 (cons ".*" liece-D-buffer))
855 "List of lists that contain regexp to match and `buffer-list' to insert.
858 (cons \"#report\" (list \"*report-buffer*\"))
859 (cons \".*\" liece-D-buffer))
860 would cause messages from and to channel #report to be displayed on
861 buffer named *report-buffer* and all other messages are displayed on
863 :type '(repeat (cons (string :tag "Channel Name")
864 (list (variable :tag "Buffe or Name"))))
867 (defcustom liece-channel-conversion-map nil
868 "The map of channel conversion."
869 :type '(repeat (cons (string :tag "Channel Name")
870 (string :tag "Channel Name (After Conversion)")))
873 (defcustom liece-channel-conversion-default-mask "*.jp"
874 "The default mask of channel conversion."
878 (defcustom liece-channel-id-length 5
879 "Length of channel ID for ! channels."
883 (defcustom liece-insert-environment-version nil
884 "If non-nil, display version description of current environment."
888 (provide 'liece-vars)
890 ;;; liece-vars.el ends here