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-display-unread-mark nil
84 "If non-nil, display unread mark as XEmacs glyphs or character to channel
89 (defcustom liece-channel-unread-character "!"
90 "Channel unread character."
94 (defcustom liece-tab-stop-list '(2 4 6 8 10 12 14 16)
95 "List of tab stop positions in dialogue buffer."
96 :type '(repeat integer)
99 (defcustom liece-icon-directory nil
100 "Normal position of liece icons."
104 (defcustom liece-nick-image-alist
105 '((?@ . "ball.red.xpm")
106 (? . "ball.blank.xpm")
107 (?+ . "ball.gray.xpm"))
108 "Normal and deformed faces for operators and voices."
109 :type '(repeat (list (character :tag "Mark")
110 (string :tag "Image")))
113 (defcustom liece-inhibit-startup-message nil
114 "If non-nil, the startup message will not be displayed.
115 This variable is used before `.liece/init.el' is loaded, so it should
116 be set in `.emacs' instead."
120 (defcustom liece-want-traditional nil
121 "Do we want /commands."
125 (defcustom liece-command-window-on-top nil
126 "If non-nil, the command window will be put at the top of the screen."
130 (defcustom liece-one-buffer-mode nil
131 "When non-nil, liece will put up only a dialogue buffer.
132 Useful for those (perverts) who use 24 line terminals."
136 (defcustom liece-display-status-on-channel-indicator nil
137 "When non-nil, liece will display channel topic on modeline."
141 (defcustom liece-directory "~/.liece"
142 "Where to look for data files."
146 (defcustom liece-variables-file (expand-file-name "init.el" liece-directory)
147 "Where to look for variables. Helps to remove clutter from your .emacs.
148 This feature is most likely to dissappear in near future. The preferred
149 way is to put liece variables on .emacs or file loaded from there."
153 (defcustom liece-variables-files
154 (list liece-variables-file)
155 "Where to look for variables. Helps to remove clutter from your .emacs.
156 This feature is most likely to dissappear in near future. The preferred
157 way is to put liece variables on .emacs or file loaded from there."
158 :type '(repeat (file :tag "Initialization File"))
162 (defgroup liece-server nil
168 (defgroup liece-channel nil
174 (define-widget 'liece-service-spec 'radio
175 "Edit service spec entries"
176 :convert-widget 'liece-service-spec-convert)
178 (defun liece-service-spec-convert (widget)
179 (widget-put widget :args '((integer :tag "Port Number")
180 (string :tag "Name")))
183 (define-widget 'liece-server-spec 'repeat
184 "Edit server spec entries"
185 :match (lambda (widget value)
190 (or (stringp (cdr entry))
191 (listp (cdr entry))))
193 :convert-widget 'liece-server-spec-convert)
195 (defun liece-server-spec-convert (widget)
196 (let* ((host '(const :format "" :value :host))
197 (service '(const :format "" :value :service))
199 (` (group :inline t (, host) (string :tag "Host"))))
201 (` (group :inline t (, service) liece-service-spec)))
205 (radio (string :tag "Host")
206 (list (, host) (, service))))))
207 (args (` ((, spec)))))
208 (widget-put widget :args args)
211 (defcustom liece-server-alist
212 '(("WIDE Project Kyoto NOC, Japan" . "irc.kyoto.wide.ad.jp")
213 ("WIDE Project Tokyo NOC, Japan" . "irc.tokyo.wide.ad.jp")
214 ("TDI RCAC / 6660" :host "irc.rcac.tdi.co.jp" :service 6660)
215 ("TDI RCAC / 6661" :host "irc.rcac.tdi.co.jp" :service 6661)
216 ("TDI RCAC / 6662" :host "irc.rcac.tdi.co.jp" :service 6662)
217 ("TDI RCAC / 6663" :host "irc.rcac.tdi.co.jp" :service 6663)
218 ("TDI RCAC / 6664" :host "irc.rcac.tdi.co.jp" :service 6664)
219 ("TDI RCAC / 6665" :host "irc.rcac.tdi.co.jp" :service 6665)
220 ("TDI RCAC / 6666" :host "irc.rcac.tdi.co.jp" :service 6666)
221 ("TDI RCAC" . "irc.rcac.tdi.co.jp")
222 ("TDI RCAC, 6Bone" . "irc6.rcac.tdi.co.jp")
223 ("RACE, University of Tokyo" . "irc.race.u-tokyo.ac.jp")
224 ("Hokkaido University, Sapporo, Japan" . "irc.huie.hokudai.ac.jp")
225 ("KARRN Hakozaki NOC" . "irc.karrn.ad.jp")
226 ("Tohoku University, Japan" . "irc.tohoku.ac.jp")
227 ("DTI, Akasaka Tokyo, Japan" . "irc.dti.ne.jp"))
228 "IRC server assoc-list which is used for input IRC server."
229 :type 'liece-server-spec
230 :group 'liece-server)
232 (defcustom liece-server (or (getenv "IRCSERVER") nil)
233 "Name of the host running the IRC server.
234 Value initialized from the IRCSERVER environment variable if one is set"
236 :group 'liece-server)
238 (defcustom liece-service
239 (let ((ircport-env (getenv "IRCPORT")))
241 (if (> (string-to-int ircport-env) 0)
242 (string-to-int ircport-env)
245 "IRC service name or (port) number."
246 :type 'liece-service-spec
247 :group 'liece-server)
249 (defcustom liece-my-userhost nil
250 "You can explicitly indicate own hostname here."
251 :type '(radio (string :tag "Hostname")
252 (const :tag "Autodetect" nil))
253 :group 'liece-server)
255 (defcustom liece-password (or (getenv "IRCPASSWORD") nil)
256 "Your password when connecting to server."
257 :type '(radio (string :tag "Password")
258 (const :tag "No" nil))
259 :group 'liece-server)
261 (defcustom liece-name (or (getenv "IRCNAME") (user-real-login-name))
262 "The nickname you want to use in IRC.
263 Default is the environment variable IRCNICK, or your login name."
265 :group 'liece-server)
267 (defcustom liece-nickname (or (getenv "IRCNICK") (user-real-login-name))
268 "The nickname you want to use in IRC.
269 Default is the environment variable IRCNICK, or your login name."
271 :group 'liece-server)
273 (defcustom liece-nick-max-length 9
274 "Maximum length of the nickname."
276 :group 'liece-server)
278 (defvar liece-real-nickname nil)
280 (defcustom liece-startup-channel nil
281 "The channel to join automatically at startup.
282 If nil, do not join any channel."
283 :type '(radio (string :tag "Channels")
285 :group 'liece-channel)
287 (defcustom liece-startup-channel-list nil
288 "The channel list to join automatically at startup.
289 If nil, do not join any channel."
290 :type '(repeat (string :tag "Startup Channel"))
291 :group 'liece-channel)
293 (defcustom liece-auto-join-partner t
294 "Whether join automatically at arriving private message."
296 :group 'liece-channel)
298 (defcustom liece-reconnect-automagic nil
299 "Automatic reconnection, default is disabled."
301 :group 'liece-server)
303 (defcustom liece-ask-for-nickname nil
304 "Ask for nickname if liece was entered with \\[universal-argument]."
306 :group 'liece-server)
308 (defcustom liece-ask-for-password nil
309 "Ask for password when connecting to server."
311 :group 'liece-server)
313 (defcustom liece-ask-for-channel-password nil
314 "Ask for channel password when joining channel with password."
316 :group 'liece-server)
318 (defcustom liece-reconnect-with-password nil
319 "Auto recconect to server with password after incorrect password."
321 :group 'liece-server)
323 (defcustom liece-grow-tail "_"
324 "Add liece-grow-tail to nick when reconnecting.
325 Otherwise you might get killed again if automagic reconnect is too fast."
327 :group 'liece-server)
329 (defcustom liece-auto-iterate-nick nil
330 "When nickname has already been in use, grow-tail automagically."
332 :group 'liece-server)
334 (defvar liece-after-registration nil
335 "After my registration.")
337 (defvar liece-status-message-string nil)
339 (defvar liece-channel-unread-list nil)
342 (defgroup liece-hook nil
348 (defcustom liece-command-mode-hook nil
349 "A hook for IRCHAT command mode."
353 (defcustom liece-dialogue-mode-hook nil
354 "A hook for IRCHAT dialogue mode."
358 (defcustom liece-others-mode-hook nil
359 "A hook for IRCHAT others mode."
363 (defcustom liece-channel-mode-hook nil
364 "A hook for IRCHAT Channel mode."
368 (defcustom liece-nick-mode-hook nil
369 "A hook for IRCHAT nick mode."
373 (defcustom liece-exit-hook nil
374 "A hook executed when signing off IRC."
378 (defcustom liece-before-kill-emacs-hook nil
379 "A hook executed when exitting Emacs."
384 (defcustom liece-channel-buffer-mode nil
385 "When non-nil, liece will display a channel buffer."
389 (defcustom liece-channel-window-height-percent 63
390 "How large percent should Current channel window be on startup."
394 (defcustom liece-default-beep nil
395 "If non nil, channel buffer local beep flag is on at starting."
399 (defcustom liece-default-freeze nil
400 "If non nil, channel buffer local freeze flag is on at starting."
404 (defcustom liece-default-own-freeze nil
405 "If non nil, channel buffer local own freeze flag is on at starting."
409 (defcustom liece-default-channel-binding nil
410 "The channel list to bind the channel number when joining."
411 :type '(repeat (radio (string :tag "Bound Channel")
413 :group 'liece-channel)
415 (defcustom liece-default-partner-binding nil
416 "The chat partner list to bind the partner's number."
417 :type '(repeat (radio (string :tag "Bound Partner")
419 :group 'liece-partner)
422 (defcustom liece-nick-buffer-mode nil
423 "When non-nil, liece will display a nick list buffer."
427 (defcustom liece-nick-window-width-percent 18
428 "How large percent should Current nick list window be on startup."
432 (defcustom liece-nick-window-auto-hide t
433 "Hide nick window in priv buffer automatically."
437 ;; Channel list buffer.
438 (defcustom liece-channel-list-buffer-mode nil
439 "When non-nil, liece will display a channel list buffer."
443 (defcustom liece-channel-list-window-width-percent 18
444 "How large percent should Current channel list window be on startup."
449 (defcustom liece-highlight-mode t
450 "If non nil, IRC buffer is highlighted by specific rule."
452 :group 'liece-highlight)
454 (defcustom liece-highlight-pattern "$^"
455 "If non nil, this pattern used for user defined highlight rule."
456 :type '(regexp :tag "Highlighting Pattern")
457 :group 'liece-highlight)
460 (defgroup liece-dcc nil
466 (defcustom liece-dcc-program "ldcc"
467 "Name of the external dcc-program.
468 Current version takes the one which is earlier in path \(if many\)."
469 :type '(file :tag "DCC program path")
472 (defcustom liece-dcc-directory "~/tmp"
473 "Directory where liece-dcc puts its files."
477 (defcustom liece-dcc-port 0
478 "Default port for DCC operations."
482 (defcustom liece-dcc-resolve-server nil
483 "Resolve IRC server FQDN with external DCC command."
487 ;; Prefix strings for various messages.
488 (defgroup liece-prefix nil
489 "Various message prefix"
494 (defgroup liece-prefix-string nil
495 "Various prefix string"
498 :group 'liece-prefix)
500 (defcustom liece-change-prefix "*** Change: "
501 "String to add before changing messages."
503 :group 'liece-prefix-string)
505 (defcustom liece-notice-prefix "*** Notice: "
506 "String to add before any notice message."
508 :group 'liece-prefix-string)
510 (defcustom liece-broadcast-prefix "*** Broadcast: "
511 "String to add before any Broadcast message."
513 :group 'liece-prefix-string)
515 (defcustom liece-wallops-prefix "*** Notice: "
516 "String to add before any WALLOPS message."
518 :group 'liece-prefix-string)
520 (defcustom liece-error-prefix "*** Error: "
521 "String to add before any ERROR message."
523 :group 'liece-prefix-string)
525 (defcustom liece-info-prefix "*** Info: "
526 "String to add before any informational message."
528 :group 'liece-prefix-string)
530 (defcustom liece-timestamp-prefix "*** Time: "
531 "String to add before any timestamp message."
533 :group 'liece-prefix-string)
535 (defcustom liece-client-prefix "*** Client: "
536 "String to add before any CTCP message."
538 :group 'liece-prefix-string)
540 (defcustom liece-dcc-prefix "*** DCC: "
541 "String to add before any DCC message."
543 :group 'liece-prefix-string)
545 (defcustom liece-time-prefix-regexp "[0-9][0-9]:[0-9][0-9] "
546 "Time prefix regexp."
548 :group 'liece-prefix)
550 (defcustom liece-display-time t
551 "If non-nil, print time prefix on each line in channel buffer."
553 :group 'liece-prefix)
555 (defcustom liece-display-prefix-tag nil
556 "If non-nil, print prefix tag on each line in channel buffer."
558 :group 'liece-prefix)
560 (defcustom liece-generic-prefix-tag-regexp "\\*\\*\\* \\([^:]+: \\)"
561 "Regular expression for generic prefix tag."
563 :group 'liece-prefix)
566 (defcustom liece-blink-parens nil
567 "Should we blink matching parenthesis in liece command buffer?"
571 (defcustom liece-show-wallops t
572 "Show wallops messages if usermode +ws."
576 (defcustom liece-ignore-extra-notices t
577 "Don't show any notice unless they come from the local server."
581 (defcustom liece-shorten-kills t
582 "Shorten KILL messages to about one line."
586 (defcustom liece-ignore-changes nil
587 "Ignore changes? Good in topic-wars/link troubles."
591 (defcustom liece-ignore-fakes nil
592 "If non nil, ignore fake notices if receiving them."
596 (defcustom liece-signoff-message nil
597 "Default signoff message."
598 :type '(radio (string :tag "Signoff message"))
601 (defcustom liece-away-message ""
602 "Default away message."
606 (defcustom liece-beep-on-bells 'always
607 "If non-nil, and the IRC dialogue buffer is not selected in a window,
608 an IRC message arriving containing a bell character, will cause you
610 If value is 'always, an arriving bell will always cause a beep (or flash)."
611 :type '(radio (const :tag "Always" always) (const :tag "No" nil))
614 (defcustom liece-beep-function (function ding)
619 (defcustom liece-beep-when-invited nil
620 "If non-nil, beep when invited."
624 (defcustom liece-beep-when-privmsg nil
625 "If non-nil, beep when received privmsg."
629 (defcustom liece-beep-words-list nil
630 "This list used for user defined beep rules."
631 :type '(repeat (string :tag "Beep Rules List"))
634 (defcustom liece-system-fqdname (system-name)
635 "The fully qualified domain name of the system.
636 Default is what (system-name) returns."
640 (defcustom liece-gather-channel-modes t
641 "Gather channel modes when joining channels."
645 (defcustom liece-use-x-face nil
646 "Display X-Face in dialogue buffer."
650 ;; Send/Receive files.
651 (defcustom liece-file-accept nil
652 "Do we accept files."
656 (defcustom liece-file-confirm-save nil
657 "Do we want confirmation on saving files."
662 (defgroup liece-ctcp nil
668 (defcustom liece-ctcp-userinfo "No user information given."
669 "Userinfo message given to anyone asking."
673 (defcustom liece-ctcp-x-face ""
674 "X-Face message given to anyone asking. Proper form is \"X-Face: ....\"."
678 (static-when (featurep 'xemacs)
679 (define-obsolete-variable-alias 'liece-client-userinfo
680 'liece-ctcp-userinfo)
681 (define-obsolete-variable-alias 'liece-client-x-face
684 (defcustom liece-timers
685 '((liece-command-poll-names liece-poll-names-interval)
686 (liece-command-keepalive liece-keepalive-interval)
687 (liece-command-poll-friends liece-poll-friends-interval))
688 "Symbol name to store timer, timer-function and timer-interval."
690 :group 'liece-server)
692 (defcustom liece-friends nil
693 "Friends to be checked consequently."
694 :type '(repeat (string :tag "Nick"))
697 (defcustom liece-display-friends-function 'liece-303-display-friends
698 "Function to display friends status."
702 (defcustom liece-poll-friends-interval 30
703 "Interval on seconds the existence of friends."
705 (integer :tag "Polling Interval in Seconds")
706 (const :tag "No" nil))
707 :group 'liece-server)
709 (defcustom liece-keepalive-interval nil
710 "Interval on seconds the existence of server connection is checked."
712 (integer :tag "Seconds"
713 :doc "Connection Interval in Seconds")
714 (const :tag "No" nil))
715 :group 'liece-server)
717 (defcustom liece-poll-names-interval nil
718 "Interval the names are polled from server."
720 (integer :tag "Seconds"
721 :doc "NAMES Polling Interval in Seconds")
722 (const :tag "No" nil))
723 :group 'liece-server)
725 (defcustom liece-timestamp-interval (* 60 10)
726 "Interval in seconds between timestamps in dialogue-buffer, nil for none."
728 (integer :tag "Seconds"
729 :doc "Timestamp Interval in Seconds")
731 :group 'liece-server)
733 (defcustom liece-connection-timeout 60
734 "Default timeout interval."
736 :group 'liece-server)
738 (defcustom liece-timestamp-format (concat liece-timestamp-prefix "%s")
739 "Format-string for timestamp."
741 :group 'liece-format-string)
743 ;; Conversions: Not used.
744 (defcustom liece-send-convert-list nil
745 "Convert characters before sending to server."
746 :type '(repeat (character :tag "Character"
747 :doc "Convert Character"))
750 (defcustom liece-receive-convert-list nil
751 "Convert characters after receiving from server."
752 :type '(repeat (character :tag "Character"
753 :doc "Convert Character"))
757 (defgroup liece-ignore nil
763 (defcustom liece-kill-nickname nil
764 "List of nicknames to be ignored.
765 Messages from these people won't be displayed."
766 :type '(repeat (string :tag "Nick" :doc "Ignore Nick"))
767 :group 'liece-ignore)
769 (defcustom liece-kill-realname nil
770 "List of real names to be ignored.
771 Messages from them won't be displayed."
772 :type '(repeat (string :tag "Realname" :doc "Ignore Realname"))
773 :group 'liece-ignore)
775 (defcustom liece-kill-logon nil
776 "List of logon names (user@host.dom.ain) to be ignored.
777 Messages from them won't be displayed."
778 :type '(repeat (string :tag "Logon" :doc "Ignore Logon Name"))
779 :group 'liece-ignore)
782 (defcustom liece-no-ignore-buffers nil
783 "A list of buffers that don't adhere to ignore-list."
784 :type '(repeat (string :tag "Buffer" :doc "Don't Ignore Buffer Names"))
785 :group 'liece-ignore)
787 (define-widget 'liece-ignore-spec 'repeat
788 "Edit server spec entries"
789 :convert-widget 'liece-ignore-spec-convert)
791 (defun liece-ignore-spec-convert (widget)
794 (string :tag "Type" :doc "Match for messagetype")
798 (string :tag "Match" :doc "Match for string-in-message")
801 '(function :doc "Function whose return value is ignore info"))
803 '(function :doc "Function whose return value is ignore user list"))
805 '(repeat :tag "Name" (string :doc "Ignore user name")))
807 (` (list :value (nil nil)
808 (choice :tag "Message"
809 (cons (, type) (, match)) (const nil) (, info-func))
810 (choice :tag "User" (const nil) (, user-func) (, name)))))
811 (args (` ((, spec)))))
812 (widget-put widget :args args)
815 (defcustom liece-ignore-list nil
816 "A list of buffers that don't adhere to ignore-list."
817 :type 'liece-ignore-spec
818 :group 'liece-ignore)
820 (defcustom liece-compress-changes t
821 "Set to t if we want instant compressed messages in the old format."
825 (defcustom liece-compress-treshold 1
826 "Number of lines to search back for a previous matching join/part/quit/mode."
830 (defcustom liece-compress-mode-length 3
831 "Number of mode compression length."
835 (defcustom liece-buffer-max-size 4242424
836 "Maximum size (in bytes) of any liece buffer."
840 (defcustom liece-buffer-default-size 4042424
841 "Size to shrink buffer if it grows too big."
845 (defcustom liece-buffer-check-interval (* 60 10)
846 "Interval between `buffer-size' checks."
850 (static-when (featurep 'xemacs)
851 (define-obsolete-variable-alias 'liece-buffer-maxsize
852 'liece-buffer-max-size)
853 (define-obsolete-variable-alias 'liece-buffer-defsize
854 'liece-buffer-default-size)
855 (define-obsolete-variable-alias 'liece-checkbuffer-interval
856 'liece-buffer-check-interval))
858 (defcustom liece-buffer-dispose-function (function bury-buffer)
859 "Function called after the buffer was disposed of."
863 (defcustom liece-private-window-height 4
864 "How tall is the window for private messages when shown."
868 (defcustom liece-format-time-function
869 'liece-compose-time-string
870 "Function to convert `current-time-string' to the human readable form.
871 If you like to have the short format, set this to nil or to a
872 funtion (defun my-format (s) s)."
876 (defcustom liece-keep-buffers t
877 "When (re)starting IRC, erase contents of old buffers."
881 (defcustom liece-scroll-step nil
882 "The number of lines to try scrolling a window by when point moves out."
883 :type '(radio (integer :tag "Scroll Step")
887 (defcustom liece-swap-private nil
888 "When showing private is it between under dialogue or not."
892 (defcustom liece-buffer-preferences
894 (cons ".*" liece-D-buffer))
895 "List of lists that contain regexp to match and `buffer-list' to insert.
898 (cons \"#report\" (list \"*report-buffer*\"))
899 (cons \".*\" liece-D-buffer))
900 would cause messages from and to channel #report to be displayed on
901 buffer named *report-buffer* and all other messages are displayed on
903 :type '(repeat (cons (string :tag "Channel Name")
904 (list (variable :tag "Buffe or Name"))))
907 (defcustom liece-channel-conversion-map nil
908 "The map of channel conversion."
909 :type '(repeat (cons (string :tag "Channel Name")
910 (string :tag "Channel Name (After Conversion)")))
913 (defcustom liece-channel-conversion-default-mask "*.jp"
914 "The default mask of channel conversion."
918 (defcustom liece-channel-id-length 5
919 "Length of channel ID for ! channels."
923 (defcustom liece-insert-environment-version nil
924 "If non-nil, display version description of current environment."
928 (provide 'liece-vars)
930 ;;; liece-vars.el ends here