Debian Codegraph @

mew-const.el

raw
1 ;;; mew-const.el
2
3 ;; Author: Kazu Yamamoto <[email protected]>
4 ;; Created: Feb 1, 1999
5
6 ;;; Code:
7
8 (require 'mew)
9
10 ;; Constants which are used in two or more files must be here.
11 ;; Constants used only in a file should be defined in the file.
12
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 ;;;
15 ;;; Readability
16 ;;;
17
18 (defconst mew-sp ?\ )
19
20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 ;;;
22 ;;; Message fields
23 ;;;
24
25 ;; Must be capitalized!
26
27 (defconst mew-subj: "Subject:")
28 (defconst mew-to: "To:")
29 (defconst mew-cc: "Cc:")
30 (defconst mew-from: "From:")
31 (defconst mew-sender: "Sender:")
32 (defconst mew-date: "Date:")
33
34 (defconst mew-bcc: "Bcc:")
35 (defconst mew-dcc: "Dcc:")
36 (defconst mew-fcc: "Fcc:")
37
38 (defconst mew-message-id: "Message-Id:")
39 (defconst mew-references: "References:")
40 (defconst mew-in-reply-to: "In-Reply-To:")
41
42 (defconst mew-resent-to: "Resent-To:")
43 (defconst mew-resent-cc: "Resent-Cc:")
44 (defconst mew-resent-from: "Resent-From:")
45 (defconst mew-resent-sender: "Resent-Sender:")
46 (defconst mew-resent-date: "Resent-Date:")
47
48 (defconst mew-resent-bcc: "Resent-Bcc:")
49 (defconst mew-resent-dcc: "Resent-Dcc:")
50 (defconst mew-resent-fcc: "Resent-Fcc:")
51
52 (defconst mew-resent-regex "^Resent-")
53
54 (defconst mew-resent-message-id: "Resent-Message-Id:")
55
56 (defconst mew-reply-to: "Reply-To:")
57 (defconst mew-organization: "Organization:")
58 (defconst mew-newsgroups: "Newsgroups:")
59 (defconst mew-distribution: "Distribution:")
60 (defconst mew-followup-to: "Followup-To:")
61
62 (defconst mew-apparently-to: "Apparently-To:")
63
64 ;; Must not include Bcc:.
65 (defconst mew-destination:-list
66 `(,mew-to: ,mew-cc: ,mew-dcc: ,mew-bcc: ,mew-apparently-to:))
67 (defconst mew-resent-dest:-list
68 `(,mew-resent-to: ,mew-resent-cc: ,mew-resent-bcc: ,mew-resent-dcc:))
69
70 (defconst mew-received: "Received:")
71
72 (defconst mew-x-mailer: "X-Mailer:")
73 (defconst mew-x-face: "X-Face:")
74 (defconst mew-face: "Face:")
75 (defconst mew-x-mew: "X-Mew:")
76 (defconst mew-x-mew-uidl: "X-Mew-Uidl:")
77 (defconst mew-x-mew-ref: "X-Mew-Ref:")
78
79 (defconst mew-x-gm-msgid: "X-GM-MSGID:")
80 (defconst mew-x-gm-thrid: "X-GM-THRID:")
81 (defconst mew-x-gm-labels: "X-GM-LABELS:")
82
83 (defconst mew-keywords: "Keywords:")
84 (defconst mew-body: "Body:")
85
86 (defconst mew-mv: "Mime-Version:")
87 (defconst mew-mv:-num "1.0")
88
89 (defconst mew-ct: "Content-Type:")
90 (defconst mew-cte: "Content-Transfer-Encoding:")
91 (defconst mew-cd: "Content-Description:")
92 (defconst mew-cid: "Content-Id:")
93 (defconst mew-cdp: "Content-Disposition:")
94
95 (defconst mew-ct-txt "Text/Plain")
96 (defconst mew-ct-htm "Text/Html")
97 (defconst mew-ct-xml "Text/Xml")
98 (defconst mew-ct-trh "Text/Rfc822-Headers")
99 (defconst mew-ct-msg "Message/Rfc822")
100 (defconst mew-ct-ext "Message/External-Body")
101 (defconst mew-ct-sts "Message/Delivery-Status")
102 (defconst mew-ct-mlm "Multipart/Mixed")
103 (defconst mew-ct-mla "Multipart/Alternative")
104 (defconst mew-ct-mls "Multipart/Signed")
105 (defconst mew-ct-mle "Multipart/Encrypted")
106 (defconst mew-ct-mld "Multipart/Digest")
107 (defconst mew-ct-ado "Audio/Basic")
108 (defconst mew-ct-apo "Application/Octet-Stream")
109 (defconst mew-ct-aps "Application/Postscript")
110 (defconst mew-ct-apk "Application/Pgp-Keys")
111 (defconst mew-ct-pgs "application/pgp-signature") ;; due to the RFC 1847 bug
112 (defconst mew-ct-pge "application/pgp-encrypted") ;; due to the RFC 1847 bug
113 (defconst mew-ct-smm "Application/Pkcs7-Mime")
114 (defconst mew-ct-xsmm "Application/X-Pkcs7-Mime")
115 (defconst mew-ct-smm-enc "enveloped-data")
116 (defconst mew-ct-smm-sig "signed-data")
117 (defconst mew-ct-sms "application/pkcs7-signature") ;; due to the RFC 1847 bug
118 (defconst mew-ct-xsms "application/x-pkcs7-signature") ;; due to the RFC 1847 bug
119
120 (defconst mew-us-ascii "us-ascii")
121 (defconst mew-utf-8 "utf-8")
122 (defconst mew-iso-2022-jp-2 "iso-2022-jp-2")
123 (defconst mew-cs-unknown 'unknown)
124 (defconst mew-cs-m17n-list `(,mew-utf-8 ,mew-iso-2022-jp-2))
125
126 (defconst mew-type-txt `(,mew-ct-txt ("charset" ,mew-us-ascii)))
127 (defconst mew-type-msg `(,mew-ct-msg))
128 (defconst mew-type-mlm `(,mew-ct-mlm))
129 (defconst mew-type-ado `(,mew-ct-ado))
130 (defconst mew-type-apo `(,mew-ct-apo))
131 (defconst mew-type-apk `(,mew-ct-apk))
132
133 (defconst mew-b64 "base64")
134 (defconst mew-qp "quoted-printable")
135 (defconst mew-xg "x-gzip64")
136 (defconst mew-7bit "7bit")
137 (defconst mew-8bit "8bit")
138 (defconst mew-bin "binary")
139 (defconst mew-xuu "x-uuencode")
140
141 (defconst mew-decode-value
142 `(,mew-b64 ,mew-qp ,mew-xg ,mew-7bit ,mew-8bit ,mew-bin ,mew-xuu))
143 (defconst mew-decode-composite-value
144 `(,mew-7bit ,mew-8bit ,mew-bin))
145
146 (defun mew-cte-p (cte)
147 (member (downcase cte) mew-decode-value))
148
149 (defun mew-cte-composite-p (cte)
150 (member (downcase cte) mew-decode-composite-value))
151
152 ;; must be list of list.
153 (defconst mew-mime-fields
154 `((,mew-ct: 0 analyze)
155 (,mew-cte: 1 extract)
156 (,mew-cd: 2 decode)
157 (,mew-cid: 3 id)
158 (,mew-cdp: 4 analyze)))
159
160 (defconst mew-syntax-magic
161 (+ (length [key beg end pri]) (length mew-mime-fields)))
162
163 (defconst mew-x-mailer
164 (format "%s on Emacs %s" mew-version emacs-version)
165 "*A value inserted into X-Mailer: field in Draft mode if *non-nil*.")
166
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
168 ;;;
169 ;;; Buffers
170 ;;;
171
172 (defconst mew-buffer-prefix " *Mew* ")
173 (defconst mew-buffer-regex "^ ?\\*Mew\\* ")
174
175 (defconst mew-buffer-cache " *mew cache*")
176 (defconst mew-buffer-cache-prefix (concat "^" (regexp-quote mew-buffer-cache)))
177
178 (defconst mew-buffer-message "*Mew message*")
179 (defconst mew-buffer-completions "*Mew completions*")
180 (defconst mew-buffer-addrbook "*Mew Addrbook*")
181 (defconst mew-buffer-debug "*Mew debug*")
182
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
184 ;;;
185 ;;; Suffix
186 ;;;
187
188 (defconst mew-ext-suffix ".ext")
189 (defconst mew-text-suffix ".txt")
190 (defconst mew-audio-suffix ".au")
191 (defconst mew-pgp-key-suffix ".pka")
192 (defconst mew-pgp-ascii-suffix ".asc")
193 (defconst mew-queue-work-suffix ".wrk")
194 (defconst mew-queue-info-suffix ".mqi")
195 (defconst mew-draft-info-suffix ".mdi")
196 (defconst mew-imapq-info-suffix ".iqi")
197 (defconst mew-backup-suffix ".old")
198 (defconst mew-backup-prefix "#")
199
200 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
201 ;;;
202 ;;; Regular expressions
203 ;;;
204
205 (defconst mew-regex-files "^[^.]\\|^.[^.]") ;; xxx "[^.]" is enough?
206
207 ;;;
208 ;;; Sumsyn
209 ;;;
210
211 (defconst mew-regex-mark "^\\([^ \n]\\)")
212 (defun mew-sumsyn-mark () (string-to-char (mew-match-string 1)))
213
214 ;; fld msg
215 (defconst mew-regex-sumsyn-short "\r \\([^ \n]*\\) \\([^ \n]+\\)")
216
217 ;; fld msg my-id par-id uid siz
218 (defconst mew-regex-sumsyn-long "\r \\([^ \n]*\\) \\([^ \n]+\\) \\([^ \n]*\\) \\([^ \n]*\\) \\([^ \n]*\\) \\([0-9]*\\)")
219
220 ;; fld msg
221 (defun mew-regex-sumsyn-msg (msg)
222 (format "\r \\([^ \n]*\\) \\(%s\\) " msg))
223
224 (defun mew-summary-search-msg (msg)
225 (let ((regex (mew-regex-sumsyn-msg msg)))
226 (when (or (re-search-forward regex nil t)
227 (re-search-backward regex nil t))
228 (beginning-of-line)
229 t)))
230
231 (defconst mew-regex-sumsyn-valid "\r \\([^ \n]*\\) \\([^ \n]+\\)")
232 (defconst mew-regex-sumsyn-invalid "\r [^ \n]* 0[1-9][0-9]*")
233
234 (defun mew-msg-validp (msg)
235 (and msg (string-match mew-regex-message-files msg)))
236
237 (defun mew-msg-invalidp (msg)
238 (and msg (string-match "^0" msg)))
239
240 (defun mew-msg-truncatedp (siz)
241 (and siz (string-match "^0" siz)))
242
243 ;; fld msg my-id par-id uid siz
244 (defun mew-regex-sumsyn-my-id (my-id)
245 (format "\r [^ \n]* [0-9]+ %s [^ \n]*" (regexp-quote my-id)))
246 (defun mew-regex-sumsyn-par-id (par-id)
247 (format "\r [^ \n]* [0-9]+ [^ \n]* %s" (regexp-quote par-id)))
248
249 ;;;
250 ;;;
251 ;;;
252
253 (defconst mew-regex-msg-icon "^\\([0-9]+\\) ")
254 (defconst mew-regex-part "^.... \\([.0-9]+\\) ")
255 (defconst mew-regex-part-icon "<\\([.0-9]+\\)>")
256
257 (defun mew-regex-jmp-part (part) (format "^.... \\(%s\\) " part))
258
259 ;; [\033\200-\377] does not work due to the multibyte
260 (defconst mew-regex-esc-or-nonascii "[^\000-\032\034-\177]") ;; \033 = esc
261 (defconst mew-regex-nonascii "[^\000-\177]")
262 (defconst mew-regex-singlebyte-nonascii
263 "\\(\\`\\|[\000-\177]\\)[^\000-\177]\\([\000-\177]\\|\\'\\)")
264
265 ;; The followings MUST contain "+" for conversion.
266 ;; \011 = tab, \012 = lf
267 (defconst mew-regex-ctls "[\000-\037\177]+")
268 (defconst mew-regex-ctls-wo-tab "[\000-\010\012-\037\177]+")
269 (defconst mew-regex-ctls-wo-tab-lf "[\000-\010\013-\037\177]+")
270
271 ;; Can skip \n. Match the first id. For example:
272 ;; In-Reply-To: Your message of "Mon, 5 Oct 1998 13:33:14 +0900"
273 ;; <[email protected]>
274 (defconst mew-regex-id "<[^>\n\t]+>")
275
276 (defconst mew-regex-case "^\\([^-+$%*,:][^,:]+\\):\\(.*\\)")
277 (defconst mew-regex-case1 "^\\([^-+$%*,:][^,:]+\\(,[^,:]+\\)*\\):\\(.*\\)")
278 (defconst mew-regex-case2 "\\([^-+$%*,:][^,:]+\\(,[^,:]+\\)*\\):")
279
280 (defconst mew-regex-punycode "xn--\\([-0-9a-zA-z]+\\)")
281
282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
283 ;;;
284 ;;; Folder
285 ;;;
286
287 (defconst mew-folder-local "+")
288 (defconst mew-folder-pop "$")
289 (defconst mew-folder-imap "%")
290 (defconst mew-folder-nntp "-")
291 (defconst mew-folder-virtual "*")
292 (defconst mew-folder-prefixes
293 `(,mew-folder-local ,mew-folder-pop ,mew-folder-imap
294 ,mew-folder-nntp ,mew-folder-virtual))
295
296 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
297 ;;;
298 ;;; Misc
299 ;;;
300
301 (defconst mew-home (file-name-as-directory "~"))
302
303 (defconst mew-case-default "default"
304 "The default value for case.")
305
306 (defconst mew-draft-coverpage "Cover.txt")
307
308 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
309 ;;;
310 ;;; Inherit
311 ;;;
312
313 (defconst mew-inherit-case nil)
314 (defconst mew-inherit-exec-case nil)
315 (defconst mew-inherit-alt nil)
316 (defconst mew-inherit-7bit nil)
317 (defconst mew-inherit-offline nil)
318 (defconst mew-inherit-decode-signer nil)
319 (defconst mew-inherit-encode-pgp-signer nil)
320 (defconst mew-inherit-encode-smime-signer nil)
321 (defconst mew-inherit-prefetching nil)
322 (defconst mew-inherit-refile-case nil)
323 (defconst mew-inherit-refile-proto nil)
324 (defconst mew-inherit-grep-cmd nil)
325 (defconst mew-inherit-after-marking nil)
326 (defconst mew-inherit-pick-tokens nil)
327 (defconst mew-inherit-pick-ret nil)
328 (defconst mew-inherit-pick-mewlp nil)
329 (defconst mew-inherit-pick-omit-and nil)
330 (defconst mew-inherit-pick-omit-and2 nil)
331 (defconst mew-inherit-submission nil)
332 (defconst mew-inherit-complete-folder nil)
333
334 (provide 'mew-const)
335
336 ;;; Copyright Notice:
337
338 ;; Copyright (C) 2000-2015 Mew developing team.
339 ;; All rights reserved.
340
341 ;; Redistribution and use in source and binary forms, with or without
342 ;; modification, are permitted provided that the following conditions
343 ;; are met:
344 ;;
345 ;; 1. Redistributions of source code must retain the above copyright
346 ;; notice, this list of conditions and the following disclaimer.
347 ;; 2. Redistributions in binary form must reproduce the above copyright
348 ;; notice, this list of conditions and the following disclaimer in the
349 ;; documentation and/or other materials provided with the distribution.
350 ;; 3. Neither the name of the team nor the names of its contributors
351 ;; may be used to endorse or promote products derived from this software
352 ;; without specific prior written permission.
353 ;;
354 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
355 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
356 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
357 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
358 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
359 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
360 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
361 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
362 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
363 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
364 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
365
366 ;;; mew-const.el ends here