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