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