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