X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=ew-var.el;h=bdabfacd92e0257a4400bde0daa7f4b331b72b73;hb=99c158b34f006c5840785347fc7e711a6b246c0c;hp=7b53b7f9fd345896142736d66929e6e247dbdd79;hpb=3278469b1133b7cc84787965d314491b0c98fff8;p=elisp%2Fflim.git diff --git a/ew-var.el b/ew-var.el index 7b53b7f..bdabfac 100644 --- a/ew-var.el +++ b/ew-var.el @@ -8,50 +8,117 @@ (defvar ew-ignore-76bytes-limit nil) (defvar ew-permit-sticked-comment nil) (defvar ew-permit-sticked-special nil) -(defvar ew-permit-null-encoded-text nil) ; affect when loading time. +(defvar ew-permit-null-encoded-text nil) (defvar ew-remove-bare-crlf nil) (defvar ew-default-mime-charset 'x-ctext) ;;; (defvar ew-decode-field-syntax-alist -'((from ew-scan-unibyte-std11 . ew:tag-mailbox+) - (sender ew-scan-unibyte-std11 . ew:tag-mailbox) - (to ew-scan-unibyte-std11 . ew:tag-address+) - (resent-to ew-scan-unibyte-std11 . ew:tag-address+) - (cc ew-scan-unibyte-std11 . ew:tag-address+) - (resent-cc ew-scan-unibyte-std11 . ew:tag-address+) - (bcc ew-scan-unibyte-std11 . ew:tag-address*) - (resent-bcc ew-scan-unibyte-std11 . ew:tag-address*) - (message-id ew-scan-unibyte-std11) - (resent-message-id ew-scan-unibyte-std11) - (in-reply-to ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*) - (references ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*) - (keywords ew-scan-unibyte-std11 . ew:tag-phrase*) - (subject ew-scan-unibyte-unstructured) - (comments ew-scan-unibyte-unstructured) - (encrypted ew-scan-unibyte-std11) - (date ew-scan-unibyte-std11) - (reply-to ew-scan-unibyte-std11 . ew:tag-address+) - (received ew-scan-unibyte-std11) - (resent-reply-to ew-scan-unibyte-std11 . ew:tag-address+) - (resent-from ew-scan-unibyte-std11 . ew:tag-mailbox+) - (resent-sender ew-scan-unibyte-std11 . ew:tag-mailbox) - (resent-date ew-scan-unibyte-std11) - (return-path ew-scan-unibyte-std11) - (mime-version ew-scan-unibyte-std11) - (content-type ew-scan-unibyte-mime) - (content-transfer-encoding ew-scan-unibyte-mime) - (content-id ew-scan-unibyte-std11) - (content-description ew-scan-unibyte-unstructured) - (content-disposition ew-scan-unibyte-mime) - (approved ew-scan-unibyte-std11 . ew:tag-address+) - (newsgroups ew-scan-unibyte-none) - (path ew-scan-unibyte-none) - (lines ew-scan-unibyte-none) - (xref ew-scan-unibyte-none) - (followup-to ew-scan-unibyte-none) -)) + '( +;;; std11 (rfc822, rfc1123) + (from ew-scan-unibyte-std11 . ew:tag-mailbox+) + (sender ew-scan-unibyte-std11 . ew:tag-mailbox) + (to ew-scan-unibyte-std11 . ew:tag-address+) + (resent-to ew-scan-unibyte-std11 . ew:tag-address+) + (cc ew-scan-unibyte-std11 . ew:tag-address+) + (resent-cc ew-scan-unibyte-std11 . ew:tag-address+) + (bcc ew-scan-unibyte-std11 . ew:tag-address*) + (resent-bcc ew-scan-unibyte-std11 . ew:tag-address*) + (message-id ew-scan-unibyte-std11) + (resent-message-id ew-scan-unibyte-std11) + (in-reply-to ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*) + (references ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*) + (keywords ew-scan-unibyte-std11 . ew:tag-phrase*) + (subject ew-scan-unibyte-unstructured) + (comments ew-scan-unibyte-unstructured) + (encrypted ew-scan-unibyte-std11) + (date ew-scan-unibyte-std11) + (reply-to ew-scan-unibyte-std11 . ew:tag-address+) + (received ew-scan-unibyte-std11) + (resent-reply-to ew-scan-unibyte-std11 . ew:tag-address+) + (resent-from ew-scan-unibyte-std11 . ew:tag-mailbox+) + (resent-sender ew-scan-unibyte-std11 . ew:tag-mailbox) + (resent-date ew-scan-unibyte-std11) + (return-path ew-scan-unibyte-std11) +;;; rfc1049 + ;; (content-type ew-scan-unibyte-std11) +;;; rfc2045 + (mime-version ew-scan-unibyte-std11) + (content-type ew-scan-unibyte-mime) + (content-transfer-encoding ew-scan-unibyte-mime) + (content-id ew-scan-unibyte-std11) + (content-description ew-scan-unibyte-unstructured) +;;; rfc2183 + (content-disposition ew-scan-unibyte-mime) +;;; rfc1864 + (content-md5 ew-scan-unibyte-none) +;;; rfc2076 + (status ew-scan-unibyte-none) +;;; draft-ietf-drums-msg-fmt-05 + ;; (date ew-scan-unibyte-std11) + ;; (from ew-scan-unibyte-std11 . ew:tag-mailbox+) + ;; (sender ew-scan-unibyte-std11 . ew:tag-mailbox) + ;; (reply-to ew-scan-unibyte-std11 . ew:tag-address+) + ;; (to ew-scan-unibyte-std11 . ew:tag-address+) + ;; (cc ew-scan-unibyte-std11 . ew:tag-address+) + ;; (bcc ew-scan-unibyte-std11 . ew:tag-address*) + ;; (message-id ew-scan-unibyte-std11) + ;; (in-reply-to ew-scan-unibyte-std11) + ;; (references ew-scan-unibyte-std11) + ;; (subject ew-scan-unibyte-unstructured) + ;; (comments ew-scan-unibyte-unstructured) + ;; (keywords ew-scan-unibyte-std11 . ew:tag-phrase*) + ;; (resent-date ew-scan-unibyte-std11) + ;; (resent-from ew-scan-unibyte-std11 . ew:tag-mailbox+) + ;; (resent-sender ew-scan-unibyte-std11 . ew:tag-mailbox) + ;; (resent-to ew-scan-unibyte-std11 . ew:tag-address+) + ;; (resent-cc ew-scan-unibyte-std11 . ew:tag-address+) + ;; (resent-bcc ew-scan-unibyte-std11 . ew:tag-address*) + ;; (resent-message-id ew-scan-unibyte-std11) + ;; (return-path ew-scan-unibyte-std11) + ;; (received ew-scan-unibyte-std11) +;;; draft-ietf-drums-mail-followup-to-00 + (mail-followup-to ew-scan-unibyte-std11 . ew:tag-mailbox+) +;;; draft-ietf-usefor-article-01 + ;; (date ew-scan-unibyte-std11) + ;; (from ew-scan-unibyte-std11 . ew:tag-mailbox+) + ;; (message-id ew-scan-unibyte-std11) + ;; (subject ew-scan-unibyte-unstructured) + (newsgroups ew-scan-unibyte-none) + (path ew-scan-unibyte-none) + (followup-to ew-scan-unibyte-none) + (expires ew-scan-unibyte-std11) + ;; (reply-to ew-scan-unibyte-std11 . ew:tag-address+) + ;; (references ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*) + (control ew-scan-unibyte-none) + (distribution ew-scan-unibyte-none) + ;; (keywords ew-scan-unibyte-std11 . ew:tag-phrase*) + (summary ew-scan-unibyte-unstructured) + (approved ew-scan-unibyte-std11 . ew:tag-mailbox+) + (lines ew-scan-unibyte-none) + (xref ew-scan-unibyte-none) + (organization ew-scan-unibyte-unstructured) + (user-agent ew-scan-unibyte-mime) + (supersedes ew-scan-unibyte-std11) + (replaces ew-scan-unibyte-std11) + (replaced-by ew-scan-unibyte-std11) + (archive ew-scan-unibyte-none) +;;; draft-ietf-usefor-posted-mailed-01 + (posted-and-mailed ew-scan-unibyte-none) + (followup-host ew-scan-unibyte-none) ; news-url +;;; draft-ietf-mailext-new-fields-13 + (auto-submitted ew-scan-unibyte-mime) + ;; (supersedes ew-scan-unibyte-std11) + ;; (expires ew-scan-unibyte-std11) +;;; others + (x-face ew-scan-unibyte-none) + (x-face-version ew-scan-unibyte-none) + (x-pgp-sig ew-scan-unibyte-none) + (x-pgp-sig-version ew-scan-unibyte-none) + (x-pgp-key-info ew-scan-unibyte-none) + (x-info ew-scan-unibyte-none) + )) (defvar ew-decode-field-default-syntax '(ew-scan-unibyte-unstructured)) @@ -60,10 +127,7 @@ ;;; constants. (defconst ew-token-regexp "[-!#-'*+0-9A-Z^-~]+") -(defconst ew-encoded-text-regexp - (if ew-permit-null-encoded-text - "[!->@-~]*" - "[!->@-~]+")) +(defconst ew-encoded-text-regexp "[!->@-~]*") (defconst ew-encoded-word-regexp (concat (regexp-quote "=?") @@ -119,16 +183,32 @@ ;;; utilities for variables. +(defconst ew-option-list + '(ew-decode-sticked-encoded-word + ew-decode-quoted-encoded-word + ew-ignore-75bytes-limit + ew-ignore-76bytes-limit + ew-permit-sticked-comment + ew-permit-sticked-special + ew-permit-null-encoded-text)) + +(defun ew-save-boolean-options () + (let ((tmp 1) (opts ew-option-list) (val 0)) + (while opts + (when (symbol-value (car opts)) (setq val (logior val tmp))) + (setq tmp (lsh tmp 1) + opts (cdr opts))) + val)) + +(defun ew-restore-boolean-options (val) + (let ((tmp 1) (opts ew-option-list)) + (while opts + (set (car opts) (not (zerop (logand val tmp)))) + (setq tmp (lsh tmp 1) + opts (cdr opts))))) + (defun ew-dynamic-options () (cons ew-default-mime-charset - (logior - (if ew-decode-sticked-encoded-word 1 0) - (if ew-decode-quoted-encoded-word 2 0) - (if ew-ignore-75bytes-limit 4 0) - (if ew-ignore-76bytes-limit 8 0) - (if ew-permit-sticked-comment 16 0) - (if ew-permit-sticked-special 32 0) - (if ew-remove-bare-crlf 64 0) - (if ew-permit-null-encoded-text 128 0) - ))) + (ew-save-boolean-options))) +