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