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