* wl-vars.el (wl-plugged): Make customizable.
[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 (defgroup elmo nil
39   "ELMO, Elisp Library for Message Orchestration."
40   :tag "ELMO"
41   :prefix "elmo-"
42   :group 'news
43   :group 'mail)
44
45 (defgroup elmo-setting nil
46   "ELMO common settings."
47   :prefix "elmo-"
48   :group 'elmo)
49
50 ;; Local
51 (defcustom elmo-localnews-folder-path "~/News"
52   "*Local news folder path."
53   :type 'directory
54   :group 'elmo)
55 (defcustom elmo-maildir-folder-path "~/Maildir"
56   "*Maildir folder path."
57   :type 'directory
58   :group 'elmo)
59 (defvar elmo-maildir-list '("\\+~/Maildir")
60   "*All Folders that match this list will be treated as Maildir.
61 Each elements are regexp of folder name (This is obsolete).")
62
63 (defvar elmo-msgdb-file-header-chop-length 2048
64   "*Number of bytes to get header in one reading from file.")
65
66 (defcustom elmo-msgdb-directory "~/.elmo"
67   "*ELMO Message Database path."
68   :type 'directory
69   :group 'elmo
70   :group 'elmo-setting)
71 (defvar elmo-passwd-alist-file-name "passwd"
72   "*ELMO Password filename.")
73 (defcustom elmo-passwd-life-time nil
74   "*Duration of ELMO Password in seconds.  nil means infinity."
75   :type '(choice (const :tag "Infinity" nil)
76                  number)
77   :group 'elmo
78   :group 'elmo-setting)
79
80 (defvar elmo-warning-threshold 30000
81   "*Display warning when the bytes of message exceeds this value.")
82
83 (defvar elmo-msg-appended-hook nil
84   "A hook called when message is appended to database.")
85 (defvar elmo-msg-deleted-hook nil
86   "A hook called when message is deleted from database.")
87 (defvar elmo-nntp-post-pre-hook nil
88   "A hook called just before the nntp posting.")
89
90 ;;; IMAP4
91
92 (defcustom elmo-imap4-default-mailbox "inbox"
93   "*Default IMAP4 mailbox."
94   :type 'string
95   :group 'elmo
96   :group 'elmo-setting)
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-msgdb-global-mark-filename "global-mark"
244   "Alist of global mark.")
245 (defvar elmo-lost+found-folder "+lost+found"
246   "Lost and found.")
247 (defvar elmo-crosspost-alist-filename "crosspost-alist"
248   "Alist of crosspost messages.")
249
250 (defvar elmo-use-server-diff t
251   "Non-nil forces to get unread message information on server.")
252
253 (defvar elmo-strict-diff-folder-list nil
254   "List of regexps of folder name which should be checked its diff strictly.")
255
256 (defcustom elmo-msgdb-extra-fields nil
257   "Extra fields for msgdb."
258   :type '(repeat string)
259   :group 'elmo
260   :group 'elmo-setting)
261
262 (defcustom elmo-enable-disconnected-operation t
263   "*Non-nil enables disconnected operations."
264   :type 'boolean
265   :group 'elmo
266   :group 'elmo-setting)
267
268 (defvar elmo-auto-change-plugged 600
269   "*Time to expire change plugged state automatically, as the number of seconds.
270 Don't change plugged state automatically if nil.")
271 (defvar elmo-plugged-condition 'one
272   "*The condition for `elmo-plugged' becomes on.
273 If `all', when all ports are on.  If `one', when even one port is on.
274 If `independent', independent port plugged.
275 If function, return value of function.")
276
277 (defvar elmo-plug-on-servers nil)
278
279 (defvar elmo-plug-on-exclude-servers
280   (list "localhost"
281         (system-name)
282         (and (string-match "[^.]+" (system-name))
283              (substring (system-name) 0 (match-end 0)))))
284
285 (defvar elmo-plugged-alist nil)
286
287 (defvar elmo-dop-flush-confirm t
288   "*Flush disconnected operations queue with confirmation.")
289
290 (defvar elmo-path-sep "/"
291   "*Path separator.")
292 (defvar elmo-plugged t)
293
294 (defvar elmo-no-subject "(No Subject in original.)"
295   "*A string used when no subject field exists.")
296 (defvar elmo-no-from "nobody@nowhere?"
297   "*A string used when no from field exists.")
298
299 ;; database dynamic linking
300 (defvar elmo-database-dl-module
301   (expand-file-name "database.so" exec-directory))
302
303 (defvar elmo-database-dl-handle
304   (if (and (fboundp 'dynamic-link)
305            (file-exists-p
306             elmo-database-dl-module))
307       (if (fboundp 'open-database)
308           t ;;
309         (dynamic-link elmo-database-dl-module))))
310
311 (if (and elmo-database-dl-handle
312          (integerp elmo-database-dl-handle))
313     (dynamic-call "emacs_database_init" elmo-database-dl-handle))
314
315 (defvar elmo-use-database (or (featurep 'dbm)
316                               (featurep 'gnudbm)
317                               (featurep 'berkdb)
318                               (featurep 'berkeley-db)
319                               ;; static/dl-database
320                               (fboundp 'open-database)))
321
322 (defvar elmo-date-match t
323   "Date match is available or not.")
324
325 (defvar elmo-network-stream-type-alist
326   '(("!"      ssl       ssl      open-ssl-stream)
327     ("!!"     starttls  starttls starttls-open-stream)
328     ("!socks" socks     socks    socks-open-network-stream))
329   "An alist of (SPEC-STRING SYMBOL FEATURE OPEN-STREAM-FUNCTION).
330 SPEC-STRING is a string for stream-type spec (it must start with '!').
331 SYMBOL is a symbol which indicates the name of the stream type.
332 SYMBOL should be identical in this alist.
333 FEATURE is a symbol of the feature for OPEN-STREAM-FUNCTION.
334 OPEN-STREAM-FUNCTION is a function to open network stream.
335 Arguments for this function are NAME, BUFFER, HOST and SERVICE.")
336
337 (defvar elmo-folder-info-hashtb nil
338   "Array of folder database information '(max length new unread).")
339
340 (defvar elmo-crosspost-message-alist nil
341   "List of crosspost message.")
342
343 (defvar elmo-cache-expire-default-method "size"
344   "Default expiration method.")
345
346 (defvar elmo-cache-expire-default-size 30000
347   "Cache expiration disk size (Kilo bytes).  This must be float value.")
348
349 (defvar elmo-cache-expire-default-age 50
350   "Cache expiration age (days).")
351
352 (defvar elmo-cache-directory (expand-file-name "cache" elmo-msgdb-directory)
353   "Directory name for cache storage.")
354
355 (defvar elmo-pack-number-check-strict t
356   "Pack number strictly.")
357
358 (defvar elmo-have-link-count
359   (not
360    ;; OS/2: EMX always returns the link count "1" :-(
361    (or (memq system-type '(OS/2 emx))
362        ;; Meadow seems to have pseudo link count.(suggestion by S.YAMAGUCHI)
363        (and (eq system-type 'windows-nt) (not (featurep 'meadow)))))
364   "Your file system has link count, or not.")
365
366 (defvar elmo-weekday-name-en '["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"])
367 (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"])
368 (defvar elmo-weekday-name-fr '["Dim" "Lun" "Mar" "Mer" "Jeu" "Ven" "Sam"])
369 (defvar elmo-weekday-name-de '["Son" "Mon" "Die" "Mit" "Don" "Fre" "Sam"])
370
371 (defvar elmo-filename-replace-string-alist
372   '((":"  . " c")
373     ("*"  . " a")
374     ("?"  . " q")
375     ("<"  . " l")
376     (">"  . " g")
377     ("\"" . " d")
378     ("|"  . " p")
379     ("/"  . " s")
380     ("\\" . " b")))
381
382 (defvar elmo-hash-minimum-size 1023
383   "Minimum size of hash table.")
384
385 (defvar elmo-hash-maximum-size 4095
386   "Maximum size of hash table.")
387
388 (defvar elmo-use-decoded-cache (featurep 'xemacs)
389   "Use cache of decoded mime charset string.")
390
391 (defvar elmo-use-overview-hashtb t
392   "Use hash table of overview.")
393
394 (defvar elmo-display-progress-threshold 20
395   "*Displaying progress gauge if number of messages are more than this value.")
396
397 (defvar elmo-inhibit-number-mapping nil
398   "Global switch to inhibit number mapping (e.g. Inhibit UIDL on POP3).")
399
400 (defvar elmo-display-retrieval-progress-threshold 30000
401   "*Don't display progress if the message size is smaller than this value.")
402
403 (defvar elmo-inhibit-display-retrieval-progress nil
404   "Global switch to inhibit display progress of each message's retrieval.")
405
406 (defvar elmo-dop-queue nil
407   "Global variable for storing disconnected operation queues.")
408
409 (require 'product)
410 (product-provide (provide 'elmo-vars) (require 'elmo-version))
411
412 ;;; elmo-vars.el ends here