* elmo-vars.el (elmo-msgdb-default-type): Remove generic from the range.
[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 ;; Message Database
61
62 (defcustom elmo-msgdb-default-type 'legacy
63   "*Default type of Message Database for ELMO."
64   :type '(radio (const legacy)
65                 (const standard))
66   :group 'elmo
67   :group 'elmo-setting)
68
69 (defcustom elmo-msgdb-convert-type nil
70   "*MODB conversion type."
71   :type '(radio (const sync)
72                 (const auto)
73                 (const :tag "No convert" nil))
74   :group 'elmo
75   :group 'elmo-setting)
76
77 (defcustom elmo-init-hook '(elmo-global-mark-migrate)
78   "*A hook called when elmo is initialized."
79   :type 'hook
80   :group 'elmo)
81
82 (defvar elmo-msgdb-file-header-chop-length 2048
83   "*Number of bytes to get header in one reading from file.")
84
85 (defcustom elmo-msgdb-directory "~/.elmo"
86   "*ELMO Message Database path."
87   :type 'directory
88   :group 'elmo
89   :group 'elmo-setting)
90 (defvar elmo-passwd-alist-file-name "passwd"
91   "*ELMO Password filename.")
92 (defcustom elmo-passwd-life-time nil
93   "*Duration of ELMO Password in seconds.  nil means infinity."
94   :type '(choice (const :tag "Infinity" nil)
95                  number)
96   :group 'elmo
97   :group 'elmo-setting)
98
99 (defvar elmo-warning-threshold 30000
100   "*Display warning when the bytes of message exceeds this value.")
101
102 (defvar elmo-msg-appended-hook nil
103   "A hook called when message is appended to database.")
104 (defvar elmo-msg-deleted-hook nil
105   "A hook called when message is deleted from database.")
106 (defvar elmo-nntp-post-pre-hook nil
107   "A hook called just before the nntp posting.")
108
109 ;;; IMAP4
110
111 (defcustom elmo-imap4-default-server "localhost"
112   "*Default IMAP4 server."
113   :type 'string
114   :group 'elmo
115   :group 'elmo-setting)
116
117 (defcustom elmo-imap4-default-authenticate-type 'login
118   "*Default Authentication type for IMAP4."
119   :type '(radio (const :tag "encoded password transmission (login)" login)
120                 (const :tag "CRAM-MD5 authentication (cram-md5)" cram-md5)
121                 (const :tag "DIGEST-MD5 authentication (digest-md5)" digest-md5)
122                 (const :tag "plain password transmission (clear)" clear)
123                 (const :tag "NTLM authentication (ntlm)" ntlm)
124                 (function :tag "Other"))
125   :group 'elmo)
126
127 (defcustom elmo-imap4-default-user (or (getenv "USER")
128                                        (getenv "LOGNAME")
129                                        (user-login-name))
130   "*Default username for IMAP4."
131   :type 'string
132   :group 'elmo
133   :group 'elmo-setting)
134
135 (defcustom elmo-imap4-default-port 143
136   "*Default Port number of IMAP."
137   :type 'integer
138   :group 'elmo
139   :group 'elmo-setting)
140
141 (defcustom elmo-imap4-default-stream-type nil
142   "*Default stream type for IMAP4.
143 Any symbol value of `elmo-network-stream-type-alist' or
144 `elmo-imap4-stream-type-alist'."
145   :type 'symbol
146   :group 'elmo)
147
148 (defvar elmo-imap4-stream-type-alist nil
149   "*Stream bindings for IMAP4.
150 This is taken precedence over `elmo-network-stream-type-alist'.")
151
152 ;;; NNTP
153
154 ;; User options
155 (defcustom elmo-nntp-default-server "localhost"
156   "*Default NNTP server."
157   :type 'string
158   :group 'elmo
159   :group 'elmo-setting)
160
161 (defcustom elmo-nntp-default-user nil
162   "*Default User of NNTP.  nil means no user authentication."
163   :type '(choice (const nil)
164                  string)
165   :group 'elmo
166   :group 'elmo-setting)
167
168 (defcustom elmo-nntp-default-port 119
169   "*Default Port number of NNTP."
170   :type 'integer
171   :group 'elmo
172   :group 'elmo-setting)
173
174 (defcustom elmo-nntp-default-stream-type nil
175   "*Default stream type for NNTP.
176 Any symbol value of `elmo-network-stream-type-alist' or
177 `elmo-nntp-stream-type-alist'."
178   :type 'symbol
179   :group 'elmo)
180
181 (defvar elmo-nntp-stream-type-alist nil
182   "*Stream bindings for NNTP.
183 This is taken precedence over `elmo-network-stream-type-alist'.")
184
185 ;;; POP3
186
187 ;; POP3
188 (defcustom elmo-pop3-default-user (or (getenv "USER")
189                                       (getenv "LOGNAME")
190                                       (user-login-name))
191   "*Default username for POP3."
192   :type 'string
193   :group 'elmo
194   :group 'elmo-setting)
195
196 (defcustom elmo-pop3-default-server  "localhost"
197   "*Default POP3 server."
198   :type 'string
199   :group 'elmo
200   :group 'elmo-setting)
201
202 (defcustom elmo-pop3-default-authenticate-type 'user
203   "*Default Authentication type for POP3."
204   :type '(radio (const :tag "plain password transmission (user)" user)
205                 (const :tag "APOP authentication (apop)" apop)
206                 (const :tag "CRAM-MD5 authentication (cram-md5)" cram-md5)
207                 (const :tag "DIGEST-MD5 authentication (digest-md5)" digest-md5)
208                 (const :tag "NTLM authentication (ntlm)" ntlm)
209                 (function :tag "Other"))
210   :group 'elmo)
211
212 (defcustom elmo-pop3-default-port 110
213   "*Default POP3 port."
214   :type 'integer
215   :group 'elmo
216   :group 'elmo-setting)
217
218 (defcustom elmo-pop3-default-stream-type nil
219   "*Default stream type for POP3.
220 Any symbol value of `elmo-network-stream-type-alist' or
221 `elmo-pop3-stream-type-alist'."
222   :type 'symbol
223   :group 'elmo)
224
225 (defvar elmo-pop3-stream-type-alist nil
226   "*Stream bindings for POP3.
227 This is taken precedence over `elmo-network-stream-type-alist'.")
228
229 (defcustom elmo-lang "ja"
230   "Language for displayed messages."
231   :type 'string
232   :group 'elmo-setting)
233
234 (defvar elmo-mime-charset 'iso-2022-jp)
235
236 (defvar elmo-msgdb-mark-filename "mark"
237   "Mark database.")
238 (defvar elmo-msgdb-overview-filename "overview"
239   "Overview database.")
240 (defvar elmo-msgdb-number-filename "number"
241   "Message number <=> Message-ID database.")
242 (defvar elmo-msgdb-location-filename "location"
243   "Message number <=> Actual location symbol.")
244 (defvar elmo-msgdb-seen-filename "seen"
245   "Seen message list for append.")
246 (defvar elmo-msgdb-killed-filename "killed"
247   "Deleted messages... contains elmo-killed-msgs-list.")
248 (defvar elmo-msgdb-validity-filename "validity")
249 (defvar elmo-msgdb-flist-filename "flist"
250   "Folder list cache (for access folder).")
251 (defvar elmo-msgdb-finfo-filename "finfo"
252   "Folder information cache...list of '(filename . '(new unread all)).")
253 (defvar elmo-msgdb-lock-list-filename "lock"
254   "Locked messages...list of message-id.
255 For disconnected operations.")
256 (defvar elmo-lost+found-folder "+lost+found"
257   "Lost and found.")
258 (defvar elmo-crosspost-alist-filename "crosspost-alist"
259   "Alist of crosspost messages.")
260
261 (defvar elmo-use-server-diff t
262   "Non-nil forces to get unread message information on server.")
263
264 (defvar elmo-strict-diff-folder-list nil
265   "List of regexps of folder name which should be checked its diff strictly.")
266
267 (defcustom elmo-msgdb-extra-fields nil
268   "Extra fields for msgdb."
269   :type '(repeat string)
270   :group 'elmo
271   :group 'elmo-setting)
272
273 (defcustom elmo-enable-disconnected-operation t
274   "*Non-nil enables disconnected operations."
275   :type 'boolean
276   :group 'elmo
277   :group 'elmo-setting)
278
279 (defvar elmo-auto-change-plugged 600
280   "*Time to expire change plugged state automatically, as the number of seconds.
281 Don't change plugged state automatically if nil.")
282 (defvar elmo-plugged-condition 'one
283   "*The condition for `elmo-plugged' becomes on.
284 If `all', when all ports are on.  If `one', when even one port is on.
285 If `independent', independent port plugged.
286 If function, return value of function.")
287
288 (defvar elmo-plug-on-servers nil)
289
290 (defvar elmo-plug-on-exclude-servers
291   (list "localhost"
292         (system-name)
293         (and (string-match "[^.]+" (system-name))
294              (substring (system-name) 0 (match-end 0)))))
295
296 (defvar elmo-plugged-alist nil)
297
298 (defvar elmo-dop-flush-confirm t
299   "*Flush disconnected operations queue with confirmation.")
300
301 (defvar elmo-path-sep "/"
302   "*Path separator.")
303 (defvar elmo-plugged t)
304
305 (defvar elmo-no-subject "(No Subject in original.)"
306   "*A string used when no subject field exists.")
307 (defvar elmo-no-from "nobody@nowhere?"
308   "*A string used when no from field exists.")
309
310 ;; database dynamic linking
311 (defvar elmo-database-dl-module
312   (expand-file-name "database.so" exec-directory))
313
314 (defvar elmo-database-dl-handle
315   (if (and (fboundp 'dynamic-link)
316            (file-exists-p
317             elmo-database-dl-module))
318       (if (fboundp 'open-database)
319           t ;;
320         (dynamic-link elmo-database-dl-module))))
321
322 (if (and elmo-database-dl-handle
323          (integerp elmo-database-dl-handle))
324     (dynamic-call "emacs_database_init" elmo-database-dl-handle))
325
326 (defvar elmo-use-database (or (featurep 'dbm)
327                               (featurep 'gnudbm)
328                               (featurep 'berkdb)
329                               (featurep 'berkeley-db)
330                               ;; static/dl-database
331                               (fboundp 'open-database)))
332
333 (defvar elmo-date-match t
334   "Date match is available or not.")
335
336 (defvar elmo-network-stream-type-alist
337   '(("!"      ssl       ssl      open-ssl-stream)
338     ("!!"     starttls  starttls starttls-open-stream)
339     ("!socks" socks     socks    socks-open-network-stream))
340   "An alist of (SPEC-STRING SYMBOL FEATURE OPEN-STREAM-FUNCTION).
341 SPEC-STRING is a string for stream-type spec (it must start with '!').
342 SYMBOL is a symbol which indicates the name of the stream type.
343 SYMBOL should be identical in this alist.
344 FEATURE is a symbol of the feature for OPEN-STREAM-FUNCTION.
345 OPEN-STREAM-FUNCTION is a function to open network stream.
346 Arguments for this function are NAME, BUFFER, HOST and SERVICE.")
347
348 (defvar elmo-folder-info-hashtb nil
349   "Array of folder database information '(max length new unread).")
350
351 (defvar elmo-crosspost-message-alist nil
352   "List of crosspost message.")
353
354 (defvar elmo-cache-expire-default-method "size"
355   "Default expiration method.")
356
357 (defvar elmo-cache-expire-default-size 30000
358   "Cache expiration disk size (Kilo bytes).  This must be float value.")
359
360 (defvar elmo-cache-expire-default-age 50
361   "Cache expiration age (days).")
362
363 (defvar elmo-cache-directory (expand-file-name "cache" elmo-msgdb-directory)
364   "Directory name for cache storage.")
365
366 (defvar elmo-pack-number-check-strict t
367   "Pack number strictly.")
368
369 (defvar elmo-have-link-count
370   (not
371    ;; OS/2: EMX always returns the link count "1" :-(
372    (or (memq system-type '(OS/2 emx))
373        ;; Meadow seems to have pseudo link count.(suggestion by S.YAMAGUCHI)
374        (and (eq system-type 'windows-nt) (not (featurep 'meadow)))))
375   "Your file system has link count, or not.")
376
377 (defvar elmo-weekday-name-en '["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"])
378 (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"])
379 (defvar elmo-weekday-name-fr '["Dim" "Lun" "Mar" "Mer" "Jeu" "Ven" "Sam"])
380 (defvar elmo-weekday-name-de '["Son" "Mon" "Die" "Mit" "Don" "Fre" "Sam"])
381
382 (defvar elmo-filename-replace-string-alist
383   '((":"  . " c")
384     ("*"  . " a")
385     ("?"  . " q")
386     ("<"  . " l")
387     (">"  . " g")
388     ("\"" . " d")
389     ("|"  . " p")
390     ("/"  . " s")
391     ("\\" . " b")))
392
393 (defvar elmo-hash-minimum-size 1023
394   "Minimum size of hash table.")
395
396 (defvar elmo-hash-maximum-size 4095
397   "Maximum size of hash table.")
398
399 (defvar elmo-use-decoded-cache (featurep 'xemacs)
400   "Use cache of decoded mime charset string.")
401
402 (defvar elmo-display-progress-threshold 20
403   "*Displaying progress gauge if number of messages are more than this value.")
404
405 (defvar elmo-inhibit-number-mapping nil
406   "Global switch to inhibit number mapping (e.g. Inhibit UIDL on POP3).")
407
408 (defvar elmo-display-retrieval-progress-threshold 30000
409   "*Don't display progress if the message size is smaller than this value.")
410
411 (defvar elmo-inhibit-display-retrieval-progress nil
412   "Global switch to inhibit display progress of each message's retrieval.")
413
414 (defvar elmo-dop-queue nil
415   "Global variable for storing disconnected operation queues.")
416
417 (defcustom elmo-mime-display-as-is-coding-system (if (boundp 'MULE)
418                                                      '*autoconv* 'undecided)
419   "*Coding system used when message is displayed as is."
420   :type 'symbol
421   :group 'elmo)
422
423 (require 'product)
424 (product-provide (provide 'elmo-vars) (require 'elmo-version))
425
426 ;;; elmo-vars.el ends here