(elmo-shimbun-update-overview): Add argnument
[elisp/wanderlust.git] / elmo / elmo-vars.el
1 ;;; elmo-vars.el --- User variables for ELMO.
2
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
4
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Keywords: mail, net news
7
8 ;; This file is part of ELMO (Elisp Library for Message Orchestration).
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14 ;;
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19 ;;
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24 ;;
25
26 ;;; Commentary:
27 ;;
28
29 ;;; Code:
30 ;;
31 (require 'poe)
32
33 ;; silence byte compiler
34 (eval-when-compile
35   (defun-maybe dynamic-link (a))
36   (defun-maybe dynamic-call (a b)))
37
38 ;; bind colon keywords for old Emacsen.
39 (dont-compile
40   (condition-case nil
41       :symbol-for-testing-whether-colon-keyword-is-available-or-not
42     (void-variable
43      (let ((kwds '(:cc :date :extra :message-id :number :references :subject)))
44        (while kwds
45          (set (car kwds) (car kwds))
46          (setq kwds (cdr kwds)))))))
47
48 (defgroup elmo nil
49   "ELMO, Elisp Library for Message Orchestration."
50   :tag "ELMO"
51   :prefix "elmo-"
52   :group 'news
53   :group 'mail)
54
55 (defgroup elmo-setting nil
56   "ELMO common settings."
57   :prefix "elmo-"
58   :group 'elmo)
59
60 (defcustom elmo-digest-flags '(unread)
61   "Flags which are treated as `digest'."
62   :type '(repeat (symbol :tag "flag"))
63   :group 'elmo)
64
65 (defcustom elmo-preserved-flags '(forwarded answered cached new unread)
66   "A list to define preserved flags.
67 Flags in this list can be searched by `any' flag condition.
68 If you want to treat a flag in this list as a `digest' flag,
69 you have to add it to `elmo-digest-flags'.
70 "
71   :type '(repeat (symbol :tag "flag"))
72   :group 'elmo)
73
74 ;; Message Database
75
76 (defcustom elmo-msgdb-default-type 'standard
77   "*Default type of Message Database for ELMO."
78   :type '(radio (const legacy)
79                 (const standard))
80   :group 'elmo
81   :group 'elmo-setting)
82
83 (defcustom elmo-msgdb-convert-type 'auto
84   "*MODB conversion type."
85   :type '(radio (const sync)
86                 (const auto)
87                 (const :tag "No convert" nil))
88   :group 'elmo
89   :group 'elmo-setting)
90
91 (defcustom elmo-init-hook '(elmo-global-mark-migrate)
92   "*A hook called when elmo is initialized."
93   :type 'hook
94   :group 'elmo)
95
96 (defvar elmo-msgdb-file-header-chop-length 2048
97   "*Number of bytes to get header in one reading from file.")
98
99 (defcustom elmo-msgdb-directory "~/.elmo"
100   "*ELMO Message Database path."
101   :type 'directory
102   :group 'elmo
103   :group 'elmo-setting)
104 (defvar elmo-passwd-alist-file-name "passwd"
105   "*ELMO Password filename.")
106 (defcustom elmo-passwd-life-time nil
107   "*Duration of ELMO Password in seconds.  nil means infinity."
108   :type '(choice (const :tag "Infinity" nil)
109                  number)
110   :group 'elmo
111   :group 'elmo-setting)
112
113 (defvar elmo-warning-threshold 30000
114   "*Display warning when the bytes of message exceeds this value.")
115
116 (defvar elmo-msg-appended-hook nil
117   "A hook called when message is appended to database.")
118 (defvar elmo-msg-deleted-hook nil
119   "A hook called when message is deleted from database.")
120 (defvar elmo-nntp-post-pre-hook nil
121   "A hook called just before the nntp posting.")
122
123 ;;; IMAP4
124
125 (defcustom elmo-imap4-default-server "localhost"
126   "*Default IMAP4 server."
127   :type 'string
128   :group 'elmo
129   :group 'elmo-setting)
130
131 (defcustom elmo-imap4-default-authenticate-type 'login
132   "*Default Authentication type for IMAP4."
133   :type '(radio (const :tag "encoded password transmission (login)" login)
134                 (const :tag "CRAM-MD5 authentication (cram-md5)" cram-md5)
135                 (const :tag "DIGEST-MD5 authentication (digest-md5)" digest-md5)
136                 (const :tag "plain password transmission (clear)" clear)
137                 (const :tag "NTLM authentication (ntlm)" ntlm)
138                 (function :tag "Other"))
139   :group 'elmo)
140
141 (defcustom elmo-imap4-default-user (or (getenv "USER")
142                                        (getenv "LOGNAME")
143                                        (user-login-name))
144   "*Default username for IMAP4."
145   :type 'string
146   :group 'elmo
147   :group 'elmo-setting)
148
149 (defcustom elmo-imap4-default-port 143
150   "*Default Port number of IMAP."
151   :type 'integer
152   :group 'elmo
153   :group 'elmo-setting)
154
155 (defcustom elmo-imap4-default-stream-type nil
156   "*Default stream type for IMAP4.
157 Any symbol value of `elmo-network-stream-type-alist' or
158 `elmo-imap4-stream-type-alist'."
159   :type 'symbol
160   :group 'elmo)
161
162 (defvar elmo-imap4-stream-type-alist nil
163   "*Stream bindings for IMAP4.
164 This is taken precedence over `elmo-network-stream-type-alist'.")
165
166 ;;; NNTP
167
168 ;; User options
169 (defcustom elmo-nntp-default-server "localhost"
170   "*Default NNTP server."
171   :type 'string
172   :group 'elmo
173   :group 'elmo-setting)
174
175 (defcustom elmo-nntp-default-user nil
176   "*Default User of NNTP.  nil means no user authentication."
177   :type '(choice (const nil)
178                  string)
179   :group 'elmo
180   :group 'elmo-setting)
181
182 (defcustom elmo-nntp-default-port 119
183   "*Default Port number of NNTP."
184   :type 'integer
185   :group 'elmo
186   :group 'elmo-setting)
187
188 (defcustom elmo-nntp-default-stream-type nil
189   "*Default stream type for NNTP.
190 Any symbol value of `elmo-network-stream-type-alist' or
191 `elmo-nntp-stream-type-alist'."
192   :type 'symbol
193   :group 'elmo)
194
195 (defvar elmo-nntp-stream-type-alist nil
196   "*Stream bindings for NNTP.
197 This is taken precedence over `elmo-network-stream-type-alist'.")
198
199 ;;; POP3
200
201 ;; POP3
202 (defcustom elmo-pop3-default-user (or (getenv "USER")
203                                       (getenv "LOGNAME")
204                                       (user-login-name))
205   "*Default username for POP3."
206   :type 'string
207   :group 'elmo
208   :group 'elmo-setting)
209
210 (defcustom elmo-pop3-default-server  "localhost"
211   "*Default POP3 server."
212   :type 'string
213   :group 'elmo
214   :group 'elmo-setting)
215
216 (defcustom elmo-pop3-default-authenticate-type 'user
217   "*Default Authentication type for POP3."
218   :type '(radio (const :tag "plain password transmission (user)" user)
219                 (const :tag "APOP authentication (apop)" apop)
220                 (const :tag "CRAM-MD5 authentication (cram-md5)" cram-md5)
221                 (const :tag "DIGEST-MD5 authentication (digest-md5)" digest-md5)
222                 (const :tag "NTLM authentication (ntlm)" ntlm)
223                 (function :tag "Other"))
224   :group 'elmo)
225
226 (defcustom elmo-pop3-default-port 110
227   "*Default POP3 port."
228   :type 'integer
229   :group 'elmo
230   :group 'elmo-setting)
231
232 (defcustom elmo-pop3-default-stream-type nil
233   "*Default stream type for POP3.
234 Any symbol value of `elmo-network-stream-type-alist' or
235 `elmo-pop3-stream-type-alist'."
236   :type 'symbol
237   :group 'elmo)
238
239 (defvar elmo-pop3-stream-type-alist nil
240   "*Stream bindings for POP3.
241 This is taken precedence over `elmo-network-stream-type-alist'.")
242
243 (defcustom elmo-lang "ja"
244   "Language for displayed messages."
245   :type 'string
246   :group 'elmo-setting)
247
248 (defvar elmo-mime-charset 'iso-2022-jp)
249
250 (defvar elmo-msgdb-mark-filename "mark"
251   "Mark database.")
252 (defvar elmo-msgdb-overview-filename "overview"
253   "Overview database.")
254 (defvar elmo-msgdb-number-filename "number"
255   "Message number <=> Message-ID database.")
256 (defvar elmo-msgdb-location-filename "location"
257   "Message number <=> Actual location symbol.")
258 (defvar elmo-msgdb-seen-filename "seen"
259   "Seen message list for append.")
260 (defvar elmo-msgdb-killed-filename "killed"
261   "Deleted messages... contains elmo-killed-msgs-list.")
262 (defvar elmo-msgdb-validity-filename "validity")
263 (defvar elmo-msgdb-flist-filename "flist"
264   "Folder list cache (for access folder).")
265 (defvar elmo-msgdb-finfo-filename "finfo"
266   "Folder information cache...list of '(filename . '(new unread all)).")
267 (defvar elmo-msgdb-lock-list-filename "lock"
268   "Locked messages...list of message-id.
269 For disconnected operations.")
270 (defvar elmo-lost+found-folder "+lost+found"
271   "Lost and found.")
272 (defvar elmo-crosspost-alist-filename "crosspost-alist"
273   "Alist of crosspost messages.")
274
275 (defvar elmo-use-server-diff t
276   "Non-nil forces to get unread message information on server.")
277
278 (defvar elmo-strict-diff-folder-list nil
279   "List of regexps of folder name which should be checked its diff strictly.")
280
281 (defcustom elmo-msgdb-prefer-in-reply-to-for-parent nil
282   "*Non-nil to prefer In-Reply-To header for finding parent message on thread,
283 rather than References header."
284   :type 'boolean
285   :group 'elmo
286   :group 'elmo-setting)
287
288 (defcustom elmo-msgdb-extra-fields nil
289   "Extra fields for msgdb."
290   :type '(repeat string)
291   :group 'elmo
292   :group 'elmo-setting)
293
294 (defcustom elmo-enable-disconnected-operation t
295   "*Non-nil enables disconnected operations."
296   :type 'boolean
297   :group 'elmo
298   :group 'elmo-setting)
299
300 (defvar elmo-auto-change-plugged 600
301   "*Time to expire change plugged state automatically, as the number of seconds.
302 Don't change plugged state automatically if nil.")
303 (defvar elmo-plugged-condition 'one
304   "*The condition for `elmo-plugged' becomes on.
305 If `all', when all ports are on.  If `one', when even one port is on.
306 If `independent', independent port plugged.
307 If function, return value of function.")
308
309 (defvar elmo-plug-on-servers nil)
310
311 (defvar elmo-plug-on-exclude-servers
312   (list "localhost"
313         (system-name)
314         (and (string-match "[^.]+" (system-name))
315              (substring (system-name) 0 (match-end 0)))))
316
317 (defvar elmo-plugged-alist nil)
318
319 (defvar elmo-dop-flush-confirm t
320   "*Flush disconnected operations queue with confirmation.")
321
322 (defvar elmo-path-sep "/"
323   "*Path separator.")
324 (defvar elmo-plugged t)
325
326 (defvar elmo-no-subject "(No Subject in original.)"
327   "*A string used when no subject field exists.")
328 (defvar elmo-no-from "nobody@nowhere?"
329   "*A string used when no from field exists.")
330
331 ;; database dynamic linking
332 (defvar elmo-database-dl-module
333   (expand-file-name "database.so" exec-directory))
334
335 (defvar elmo-database-dl-handle
336   (if (and (fboundp 'dynamic-link)
337            (file-exists-p
338             elmo-database-dl-module))
339       (if (fboundp 'open-database)
340           t ;;
341         (dynamic-link elmo-database-dl-module))))
342
343 (if (and elmo-database-dl-handle
344          (integerp elmo-database-dl-handle))
345     (dynamic-call "emacs_database_init" elmo-database-dl-handle))
346
347 (defvar elmo-use-database (or (featurep 'dbm)
348                               (featurep 'gnudbm)
349                               (featurep 'berkdb)
350                               (featurep 'berkeley-db)
351                               ;; static/dl-database
352                               (fboundp 'open-database)))
353
354 (defvar elmo-date-match t
355   "Date match is available or not.")
356
357 (defvar elmo-network-stream-type-alist
358   '(("!"      ssl       ssl      open-ssl-stream)
359     ("!!"     starttls  starttls starttls-open-stream)
360     ("!socks" socks     socks    socks-open-network-stream)
361     ("!direct" direct   nil   open-network-stream))
362   "An alist of (SPEC-STRING SYMBOL FEATURE OPEN-STREAM-FUNCTION).
363 SPEC-STRING is a string for stream-type spec (it must start with '!').
364 SYMBOL is a symbol which indicates the name of the stream type.
365 SYMBOL should be identical in this alist.
366 FEATURE is a symbol of the feature for OPEN-STREAM-FUNCTION.
367 OPEN-STREAM-FUNCTION is a function to open network stream.
368 Arguments for this function are NAME, BUFFER, HOST and SERVICE.")
369
370 (defvar elmo-folder-info-hashtb nil
371   "Array of folder database information '(max length new unread).")
372
373 (defvar elmo-crosspost-message-alist nil
374   "List of crosspost message.")
375
376 (defvar elmo-cache-expire-default-method "size"
377   "Default expiration method.")
378
379 (defvar elmo-cache-expire-default-size 30000
380   "Cache expiration disk size (Kilo bytes).  This must be float value.")
381
382 (defvar elmo-cache-expire-default-age 50
383   "Cache expiration age (days).")
384
385 (defvar elmo-cache-directory (expand-file-name "cache" elmo-msgdb-directory)
386   "Directory name for cache storage.")
387
388 (defvar elmo-pack-number-check-strict t
389   "Pack number strictly.")
390
391 (defvar elmo-have-link-count
392   (not
393    ;; OS/2: EMX always returns the link count "1" :-(
394    (or (memq system-type '(OS/2 emx))
395        ;; Meadow seems to have pseudo link count.(suggestion by S.YAMAGUCHI)
396        (and (eq system-type 'windows-nt) (not (featurep 'meadow)))))
397   "Your file system has link count, or not.")
398
399 (defvar elmo-use-hardlink
400   ;; Any Emacsen may have add-name-to-file(), because loadup.el
401   ;; requires it. :-p Check make-symbolic-link() instead.
402   (fboundp 'make-symbolic-link)
403   "Hardlink is available on your file system, or not.")
404
405 (defvar elmo-weekday-name-en '["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"])
406 (defvar elmo-weekday-name-ja '["\e$BF|\e(B" "\e$B7n\e(B" "\e$B2P\e(B" "\e$B?e\e(B" "\e$BLZ\e(B" "\e$B6b\e(B" "\e$BEZ\e(B"])
407 (defvar elmo-weekday-name-fr '["Dim" "Lun" "Mar" "Mer" "Jeu" "Ven" "Sam"])
408 (defvar elmo-weekday-name-de '["Son" "Mon" "Die" "Mit" "Don" "Fre" "Sam"])
409
410 (defvar elmo-filename-replace-string-alist
411   '((":"  . " c")
412     ("*"  . " a")
413     ("?"  . " q")
414     ("<"  . " l")
415     (">"  . " g")
416     ("\"" . " d")
417     ("|"  . " p")
418     ("/"  . " s")
419     ("\\" . " b")))
420
421 (defvar elmo-hash-minimum-size 1023
422   "Minimum size of hash table.")
423
424 (defvar elmo-hash-maximum-size 4095
425   "Maximum size of hash table.")
426
427 (defvar elmo-use-decoded-cache (featurep 'xemacs)
428   "Use cache of decoded mime charset string.")
429
430 (defvar elmo-inhibit-number-mapping nil
431   "Global switch to inhibit number mapping (e.g. Inhibit UIDL on POP3).")
432
433 (defvar elmo-dop-queue nil
434   "Global variable for storing disconnected operation queues.")
435
436 (defcustom elmo-mime-display-as-is-coding-system (if (boundp 'MULE)
437                                                      '*autoconv* 'undecided)
438   "*Coding system used when message is displayed as is."
439   :type 'symbol
440   :group 'elmo)
441
442 (defcustom elmo-mailing-list-name-spec-list
443   '(x-ml-name
444     (x-sequence "^\\([^ ]+\\)")
445     (subject "^\\s(\\(\\S)+\\)[ :][0-9]+\\s)[ \t]*")
446     (list-post "<mailto:\\(.+\\)@")
447     (list-id "<\\([^.]+\\)\\." "^\\([^.]+\\)\\.")
448     (mailing-list ("\\(^\\|; \\)contact \\([^@]+\\)-[^-@]+@" . 2))
449     (return-path "^<\\([^@>]+\\)-return-[0-9]+-")
450     (delivered-to "^mailing list \\([^@]+\\)@"))
451   "*List of spec to extract mailing list name from field value."
452   :type '(repeat
453           (choice (symbol :tag "Field Name")
454                   (list (symbol :tag "Field Name")
455                         (repeat
456                          :inline symbol
457                          (choice regexp
458                                  (cons regexp
459                                        (integer :tag "Match Index")))))))
460   :group 'elmo)
461
462 (defcustom elmo-mailing-list-count-spec-list
463   '(x-mail-count
464     x-ml-count
465     (x-sequence "^[^ ]+ \\([^ ]+\\)")
466     (subject "^\\s(\\S)+[ :]\\([0-9]+\\)\\s)[ \t]*")
467     (return-path "^<[^@>]+-return-\\([0-9]+\\)-"))
468   "*List of spec to extract mailing list count from field value."
469   :type '(repeat
470           (choice (symbol :tag "Field Name")
471                   (list (symbol :tag "Field Name")
472                         (repeat
473                          :inline symbol
474                          (choice regexp
475                                  (cons regexp
476                                        (integer :tag "Match Index")))))))
477   :group 'elmo)
478
479 (require 'product)
480 (product-provide (provide 'elmo-vars) (require 'elmo-version))
481
482 ;;; elmo-vars.el ends here