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 nil
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 ("Hokkaido University, Sapporo, Japan" . "irc.huie.hokudai.ac.jp")
215 ("DTI, Akasaka Tokyo, Japan" . "irc.dti.ne.jp")
216 ("WIDE Project Fujisawa NOC, Japan" . "irc.fujisawa.wide.ad.jp")
217 ("WIDE Project Kyoto NOC, Japan (IPv6)" . "irc6.kyoto.wide.ad.jp"))
218 "IRC server assoc-list which is used for input IRC server."
219 :type 'liece-server-spec
220 :group 'liece-server)
222 (defcustom liece-server (or (getenv "IRCSERVER") nil)
223 "Name of the host running the IRC server.
224 Value initialized from the IRCSERVER environment variable if one is set"
226 :group 'liece-server)
228 (defcustom liece-service
229 (let ((ircport-env (getenv "IRCPORT")))
231 (if (> (string-to-int ircport-env) 0)
232 (string-to-int ircport-env)
235 "IRC service name or (port) number."
236 :type 'liece-service-spec
237 :group 'liece-server)
239 (defcustom liece-my-userhost nil
240 "You can explicitly indicate own hostname here."
241 :type '(radio (string :tag "Hostname")
242 (const :tag "Autodetect" nil))
243 :group 'liece-server)
245 (defcustom liece-password (or (getenv "IRCPASSWORD") nil)
246 "Your password when connecting to server."
247 :type '(radio (string :tag "Password")
248 (const :tag "No" nil))
249 :group 'liece-server)
251 (defcustom liece-name (or (getenv "IRCNAME") (user-real-login-name))
252 "The nickname you want to use in IRC.
253 Default is the environment variable IRCNICK, or your login name."
255 :group 'liece-server)
257 (defcustom liece-nickname (or (getenv "IRCNICK") (user-real-login-name))
258 "The nickname you want to use in IRC.
259 Default is the environment variable IRCNICK, or your login name."
261 :group 'liece-server)
263 (defcustom liece-nick-max-length 9
264 "Maximum length of the nickname."
266 :group 'liece-server)
268 (defvar liece-real-nickname nil)
270 (defcustom liece-startup-channel nil
271 "The channel to join automatically at startup.
272 If nil, do not join any channel."
273 :type '(radio (string :tag "Channels")
275 :group 'liece-channel)
277 (defcustom liece-startup-channel-list nil
278 "The channel list to join automatically at startup.
279 If nil, do not join any channel."
280 :type '(repeat (string :tag "Startup Channel"))
281 :group 'liece-channel)
283 (defcustom liece-auto-join-partner t
284 "Whether join automatically at arriving private message."
286 :group 'liece-channel)
288 (defcustom liece-reconnect-automagic nil
289 "Automatic reconnection, default is disabled."
291 :group 'liece-server)
293 (defcustom liece-ask-for-nickname nil
294 "Ask for nickname if liece was entered with \\[universal-argument]."
296 :group 'liece-server)
298 (defcustom liece-ask-for-password nil
299 "Ask for password when connecting to server."
301 :group 'liece-server)
303 (defcustom liece-ask-for-channel-password nil
304 "Ask for channel password when joining channel with password."
306 :group 'liece-server)
308 (defcustom liece-reconnect-with-password nil
309 "Auto recconect to server with password after incorrect password."
311 :group 'liece-server)
313 (defcustom liece-grow-tail "_"
314 "Add liece-grow-tail to nick when reconnecting.
315 Otherwise you might get killed again if automagic reconnect is too fast."
317 :group 'liece-server)
319 (defcustom liece-auto-iterate-nick nil
320 "When nickname has already been in use, grow-tail automagically."
322 :group 'liece-server)
324 (defvar liece-after-registration nil
325 "After my registration.")
327 (defvar liece-status-message-string nil)
329 (defvar liece-channel-unread-list nil)
332 (defgroup liece-hook nil
338 (defcustom liece-command-mode-hook nil
339 "A hook for IRCHAT command mode."
343 (defcustom liece-dialogue-mode-hook nil
344 "A hook for IRCHAT dialogue mode."
348 (defcustom liece-others-mode-hook nil
349 "A hook for IRCHAT others mode."
353 (defcustom liece-channel-mode-hook nil
354 "A hook for IRCHAT Channel mode."
358 (defcustom liece-nick-mode-hook nil
359 "A hook for IRCHAT nick mode."
363 (defcustom liece-exit-hook nil
364 "A hook executed when signing off IRC."
368 (defcustom liece-before-kill-emacs-hook nil
369 "A hook executed when exitting Emacs."
374 (defcustom liece-channel-buffer-mode t
375 "When non-nil, liece will display a channel buffer."
379 (defcustom liece-channel-window-height-percent 63
380 "How large percent should Current channel window be on startup."
384 (defcustom liece-default-beep nil
385 "If non nil, channel buffer local beep flag is on at starting."
389 (defcustom liece-default-freeze nil
390 "If non nil, channel buffer local freeze flag is on at starting."
394 (defcustom liece-default-own-freeze nil
395 "If non nil, channel buffer local own freeze flag is on at starting."
399 (defcustom liece-default-channel-binding nil
400 "The channel list to bind the channel number when joining."
401 :type '(repeat (radio (string :tag "Bound Channel")
403 :group 'liece-channel)
405 (defcustom liece-default-partner-binding nil
406 "The chat partner list to bind the partner's number."
407 :type '(repeat (radio (string :tag "Bound Partner")
409 :group 'liece-partner)
412 (defcustom liece-nick-buffer-mode t
413 "When non-nil, liece will display a nick list buffer."
417 (defcustom liece-nick-window-width-percent 18
418 "How large percent should Current nick list window be on startup."
422 (defcustom liece-nick-window-auto-hide t
423 "Hide nick window in priv buffer automatically."
427 ;; Channel list buffer.
428 (defcustom liece-channel-list-buffer-mode t
429 "When non-nil, liece will display a channel list buffer."
433 (defcustom liece-channel-list-window-width-percent 18
434 "How large percent should Current channel list window be on startup."
439 (defcustom liece-highlight-mode t
440 "If non nil, IRC buffer is highlighted by specific rule."
442 :group 'liece-highlight)
444 (defcustom liece-highlight-pattern "$^"
445 "If non nil, this pattern used for user defined highlight rule."
446 :type '(regexp :tag "Highlighting Pattern")
447 :group 'liece-highlight)
450 (defgroup liece-dcc nil
456 (defcustom liece-dcc-program "ldcc"
457 "Name of the external dcc-program.
458 Current version takes the one which is earlier in path \(if many\)."
459 :type '(file :tag "DCC program path")
462 (defcustom liece-dcc-directory "~/tmp"
463 "Directory where liece-dcc puts its files."
467 (defcustom liece-dcc-port 0
468 "Default port for DCC operations."
472 (defcustom liece-dcc-resolve-server nil
473 "Resolve IRC server FQDN with external DCC command."
477 ;; Prefix strings for various messages.
478 (defgroup liece-prefix nil
479 "Various message prefix"
484 (defgroup liece-prefix-string nil
485 "Various prefix string"
488 :group 'liece-prefix)
490 (defcustom liece-change-prefix "*** Change: "
491 "String to add before changing messages."
493 :group 'liece-prefix-string)
495 (defcustom liece-notice-prefix "*** Notice: "
496 "String to add before any notice message."
498 :group 'liece-prefix-string)
500 (defcustom liece-broadcast-prefix "*** Broadcast: "
501 "String to add before any Broadcast message."
503 :group 'liece-prefix-string)
505 (defcustom liece-wallops-prefix "*** Notice: "
506 "String to add before any WALLOPS message."
508 :group 'liece-prefix-string)
510 (defcustom liece-error-prefix "*** Error: "
511 "String to add before any ERROR message."
513 :group 'liece-prefix-string)
515 (defcustom liece-info-prefix "*** Info: "
516 "String to add before any informational message."
518 :group 'liece-prefix-string)
520 (defcustom liece-timestamp-prefix "*** Time: "
521 "String to add before any timestamp message."
523 :group 'liece-prefix-string)
525 (defcustom liece-client-prefix "*** Client: "
526 "String to add before any CTCP message."
528 :group 'liece-prefix-string)
530 (defcustom liece-dcc-prefix "*** DCC: "
531 "String to add before any DCC message."
533 :group 'liece-prefix-string)
535 (defcustom liece-time-prefix-regexp "[0-9][0-9]:[0-9][0-9] "
536 "Time prefix regexp."
538 :group 'liece-prefix)
540 (defcustom liece-display-time t
541 "If non-nil, print time prefix on each line in channel buffer."
543 :group 'liece-prefix)
545 (defcustom liece-display-prefix-tag nil
546 "If non-nil, print prefix tag on each line in channel buffer."
548 :group 'liece-prefix)
550 (defcustom liece-generic-prefix-tag-regexp "\\*\\*\\* \\([^:]+: \\)"
551 "Regular expression for generic prefix tag."
553 :group 'liece-prefix)
556 (defcustom liece-blink-parens nil
557 "Should we blink matching parenthesis in liece command buffer?"
561 (defcustom liece-show-wallops t
562 "Show wallops messages if usermode +ws."
566 (defcustom liece-ignore-extra-notices t
567 "Don't show any notice unless they come from the local server."
571 (defcustom liece-shorten-kills t
572 "Shorten KILL messages to about one line."
576 (defcustom liece-ignore-changes nil
577 "Ignore changes? Good in topic-wars/link troubles."
581 (defcustom liece-ignore-fakes nil
582 "If non nil, ignore fake notices if receiving them."
586 (defcustom liece-signoff-message nil
587 "Default signoff message."
588 :type '(radio (string :tag "Signoff message"))
591 (defcustom liece-away-message ""
592 "Default away message."
596 (defcustom liece-beep-on-bells 'always
597 "If non-nil, and the IRC dialogue buffer is not selected in a window,
598 an IRC message arriving containing a bell character, will cause you
600 If value is 'always, an arriving bell will always cause a beep (or flash)."
601 :type '(radio (const :tag "Always" always) (const :tag "No" nil))
604 (defcustom liece-beep-function (function ding)
609 (defcustom liece-beep-when-invited nil
610 "If non-nil, beep when invited."
614 (defcustom liece-beep-when-privmsg nil
615 "If non-nil, beep when received privmsg."
619 (defcustom liece-beep-words-list nil
620 "This list used for user defined beep rules."
621 :type '(repeat (string :tag "Beep Rules List"))
624 (defcustom liece-system-fqdname (system-name)
625 "The fully qualified domain name of the system.
626 Default is what (system-name) returns."
630 (defcustom liece-gather-channel-modes t
631 "Gather channel modes when joining channels."
635 (defcustom liece-use-x-face nil
636 "Display X-Face in dialogue buffer."
640 ;; Send/Receive files.
641 (defcustom liece-file-accept nil
642 "Do we accept files."
646 (defcustom liece-file-confirm-save nil
647 "Do we want confirmation on saving files."
652 (defgroup liece-ctcp nil
658 (defcustom liece-ctcp-userinfo "No user information given."
659 "Userinfo message given to anyone asking."
663 (defcustom liece-ctcp-x-face ""
664 "X-Face message given to anyone asking. Proper form is \"X-Face: ....\"."
668 (static-when (featurep 'xemacs)
669 (define-obsolete-variable-alias 'liece-client-userinfo
670 'liece-ctcp-userinfo)
671 (define-obsolete-variable-alias 'liece-client-x-face
674 (defcustom liece-timers
675 '((liece-command-poll-names liece-poll-names-interval)
676 (liece-command-keepalive liece-keepalive-interval)
677 (liece-command-poll-friends liece-poll-friends-interval))
678 "Symbol name to store timer, timer-function and timer-interval."
679 :type '(repeat (list symbol symbol))
680 :group 'liece-server)
682 (defcustom liece-friends nil
683 "Friends to be checked consequently."
684 :type '(repeat (string :tag "Nick"))
687 (defcustom liece-display-friends-function 'liece-303-display-friends
688 "Function to display friends status."
692 (defcustom liece-poll-friends-interval 30
693 "Interval on seconds the existence of friends."
695 (integer :tag "Polling Interval in Seconds")
696 (const :tag "No" nil))
697 :group 'liece-server)
699 (defcustom liece-keepalive-interval nil
700 "Interval on seconds the existence of server connection is checked."
702 (integer :tag "Seconds"
703 :doc "Connection Interval in Seconds")
704 (const :tag "No" nil))
705 :group 'liece-server)
707 (defcustom liece-poll-names-interval nil
708 "Interval the names are polled from server."
710 (integer :tag "Seconds"
711 :doc "NAMES Polling Interval in Seconds")
712 (const :tag "No" nil))
713 :group 'liece-server)
715 (defcustom liece-timestamp-interval (* 60 10)
716 "Interval in seconds between timestamps in dialogue-buffer, nil for none."
718 (integer :tag "Seconds"
719 :doc "Timestamp Interval in Seconds")
721 :group 'liece-server)
723 (defcustom liece-connection-timeout 60
724 "Default timeout interval."
726 :group 'liece-server)
728 (defcustom liece-timestamp-format (concat liece-timestamp-prefix "%s")
729 "Format-string for timestamp."
731 :group 'liece-format-string)
733 ;; Conversions: Not used.
734 (defcustom liece-send-convert-list nil
735 "Convert characters before sending to server."
736 :type '(repeat (character :tag "Character"
737 :doc "Convert Character"))
740 (defcustom liece-receive-convert-list nil
741 "Convert characters after receiving from server."
742 :type '(repeat (character :tag "Character"
743 :doc "Convert Character"))
747 (defgroup liece-ignore nil
753 (defcustom liece-kill-nickname nil
754 "List of nicknames to be ignored.
755 Messages from these people won't be displayed."
756 :type '(repeat (string :tag "Nick" :doc "Ignore Nick"))
757 :group 'liece-ignore)
759 (defcustom liece-kill-realname nil
760 "List of real names to be ignored.
761 Messages from them won't be displayed."
762 :type '(repeat (string :tag "Realname" :doc "Ignore Realname"))
763 :group 'liece-ignore)
765 (defcustom liece-kill-logon nil
766 "List of logon names (user@host.dom.ain) to be ignored.
767 Messages from them won't be displayed."
768 :type '(repeat (string :tag "Logon" :doc "Ignore Logon Name"))
769 :group 'liece-ignore)
772 (defcustom liece-no-ignore-buffers nil
773 "A list of buffers that don't adhere to ignore-list."
774 :type '(repeat (string :tag "Buffer" :doc "Don't Ignore Buffer Names"))
775 :group 'liece-ignore)
777 (define-widget 'liece-ignore-spec 'repeat
778 "Edit server spec entries"
779 :convert-widget 'liece-ignore-spec-convert)
781 (defun liece-ignore-spec-convert (widget)
784 (string :tag "Type" :doc "Match for messagetype")
788 (string :tag "Match" :doc "Match for string-in-message")
791 '(function :doc "Function whose return value is ignore info"))
793 '(function :doc "Function whose return value is ignore user list"))
795 '(repeat :tag "Name" (string :doc "Ignore user name")))
797 (` (list :value (nil nil)
798 (choice :tag "Message"
799 (cons (, type) (, match)) (const nil) (, info-func))
800 (choice :tag "User" (const nil) (, user-func) (, name)))))
801 (args (` ((, spec)))))
802 (widget-put widget :args args)
805 (defcustom liece-ignore-list nil
806 "A list of buffers that don't adhere to ignore-list."
807 :type 'liece-ignore-spec
808 :group 'liece-ignore)
810 (defcustom liece-compress-changes t
811 "Set to t if we want instant compressed messages in the old format."
815 (defcustom liece-compress-treshold 1
816 "Number of lines to search back for a previous matching join/part/quit/mode."
820 (defcustom liece-compress-mode-length 3
821 "Number of mode compression length."
825 (defcustom liece-buffer-max-size 4242424
826 "Maximum size of buffers, the number of characters."
830 (defcustom liece-buffer-min-size (- liece-buffer-max-size 200000)
831 "Minimum size of buffers, the number of characters."
835 (defcustom liece-buffer-check-interval (* 60 10)
836 "Interval between `buffer-size' checks."
840 (static-when (featurep 'xemacs)
841 (define-obsolete-variable-alias 'liece-buffer-maxsize
842 'liece-buffer-max-size)
843 (define-obsolete-variable-alias 'liece-buffer-defsize
844 'liece-buffer-min-size)
845 (define-obsolete-variable-alias 'liece-checkbuffer-interval
846 'liece-buffer-check-interval))
848 (defcustom liece-buffer-dispose-function (function bury-buffer)
849 "Function called after the buffer was disposed of."
853 (defcustom liece-private-window-height 4
854 "How tall is the window for private messages when shown."
858 (defcustom liece-format-time-function
859 'liece-compose-time-string
860 "Function to convert `current-time-string' to the human readable form.
861 If you like to have the short format, set this to nil or to a
862 funtion (defun my-format (s) s)."
866 (defcustom liece-keep-buffers t
867 "When (re)starting IRC, erase contents of old buffers."
871 (defcustom liece-scroll-step nil
872 "The number of lines to try scrolling a window by when point moves out."
873 :type '(radio (integer :tag "Scroll Step")
877 (defcustom liece-swap-private nil
878 "When showing private is it between under dialogue or not."
882 (defcustom liece-buffer-preferences
884 (cons ".*" liece-D-buffer))
885 "List of lists that contain regexp to match and `buffer-list' to insert.
888 (cons \"#report\" (list \"*report-buffer*\"))
889 (cons \".*\" liece-D-buffer))
890 would cause messages from and to channel #report to be displayed on
891 buffer named *report-buffer* and all other messages are displayed on
893 :type '(repeat (cons (string :tag "Channel Name")
894 (list (variable :tag "Buffe or Name"))))
897 (defcustom liece-channel-conversion-map nil
898 "The map of channel conversion."
899 :type '(repeat (cons (string :tag "Channel Name")
900 (string :tag "Channel Name (After Conversion)")))
903 (defcustom liece-channel-conversion-default-mask "*.jp"
904 "The default mask of channel conversion."
908 (defcustom liece-channel-id-length 5
909 "Length of channel ID for ! channels."
913 (defcustom liece-insert-environment-version nil
914 "If non-nil, display version description of current environment."
918 (provide 'liece-vars)
920 ;;; liece-vars.el ends here