~ubuntu-branches/ubuntu/karmic/mew-beta/karmic

« back to all changes in this revision

Viewing changes to mew-vars2.el

  • Committer: Bazaar Package Importer
  • Author(s): Tatsuya Kinoshita
  • Date: 2008-04-24 00:28:17 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20080424002817-68vgq5lfqr8z0795
Tags: 6.0.51~0.20080421-1
New upstream release. (CVS trunk on 2008-04-21)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
;;; (1) Variables closer to constant.
11
11
;;; (2) Variables for soft-coding.
12
12
;;; (3) Difficult options with some macros.
13
 
;;; Use mew-add-first, mew-insert-after, mew-replace-with, 
 
13
;;; Use mew-add-first, mew-insert-after, mew-replace-with,
14
14
;;; and mew-remove-entry to modify the variables.
15
15
 
16
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52
52
  "Regexp of various (was ...) expression in Subject:")
53
53
 
54
54
(defvar mew-subject-simplify-replace-alist
55
 
  (list
56
 
   ;; (REGEXP . NEW) --- NEW may be nil for deletion (same to "")
57
 
   ;; replace multiple Re: and Fw: into single Re:
58
 
   (cons (concat "^" ;; regexp
59
 
                 mew-reply-regex
60
 
                 "\\("
61
 
                 mew-reply-regex
62
 
                 "\\|"
63
 
                 mew-forward-regex
64
 
                 "\\)*")
65
 
         'mew-reply-string) ;; new text
66
 
   ;; replace multiple Fw: and Re: into single Fw:
67
 
   (cons (concat "^" ;; regexp
68
 
                 mew-forward-regex
69
 
                 "\\("
70
 
                 mew-reply-regex
71
 
                 "\\|"
72
 
                 mew-forward-regex
73
 
                 "\\)*")
74
 
         'mew-forward-string) ;; new text
75
 
   ;; delete extra string (no new text means delete)
76
 
   (cons mew-was-regex nil)) ;; regexp
 
55
  `(;; (REGEXP . NEW) --- NEW may be nil for deletion (same to "")
 
56
    ;; replace multiple Re: and Fw: into single Re:
 
57
    (,(concat "^" ;; regexp
 
58
              mew-reply-regex
 
59
              "\\("
 
60
              mew-reply-regex
 
61
              "\\|"
 
62
              mew-forward-regex
 
63
              "\\)*")
 
64
     mew-reply-string) ;; new text
 
65
    ;; replace multiple Fw: and Re: into single Fw:
 
66
    (,(concat "^" ;; regexp
 
67
              mew-forward-regex
 
68
              "\\("
 
69
              mew-reply-regex
 
70
              "\\|"
 
71
              mew-forward-regex
 
72
              "\\)*")
 
73
     mew-forward-string) ;; new text
 
74
    ;; delete extra string (no new text means delete)
 
75
    (,mew-was-regex nil)) ;; regexp
77
76
  "*Replacement alist to simplify Subject: field body
78
77
Each element is cons cell whos car is REGEXP to replace,
79
78
cdr is new text.")
152
151
(defvar mew-address-separator ":, \t\n")
153
152
(defvar mew-page-delimiter "^\^L")
154
153
(defvar mew-keyval "^\\([^ \t:]+:?\\)[ \t]*")
155
 
;; "^\\([^ \t:]+:?\\)[ \t]*\\(.*\\)$" faces a stupid error. 
 
154
;; "^\\([^ \t:]+:?\\)[ \t]*\\(.*\\)$" faces a stupid error.
156
155
;; "$" does not mean end-of-line if the second match is empty, sigh.
157
156
 
158
157
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
171
170
;;;
172
171
 
173
172
(defvar mew-addrbook-switch
174
 
  '((shortname . mew-addrbook-shortname-get)
175
 
    (address   . identity)
176
 
    (username  . mew-addrstr-extract-user)
177
 
    (nickname  . mew-addrbook-nickname-get)
178
 
    (name      . mew-addrbook-name-get))
 
173
  '((shortname mew-addrbook-shortname-get)
 
174
    (address   identity)
 
175
    (username  mew-addrstr-extract-user)
 
176
    (nickname  mew-addrbook-nickname-get)
 
177
    (name      mew-addrbook-name-get))
179
178
  "Function database to get each field of Addrbook.
180
179
'shortname, 'address, 'username, 'nickname, and 'name is defined.")
181
180
 
182
 
(defsubst mew-addrbook-func (key)
183
 
  (cdr (assq key mew-addrbook-switch)))
184
 
 
 
181
(defun mew-addrbook-func (key)
 
182
  (mew-alist-get-value (assq key mew-addrbook-switch)))
185
183
 
186
184
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187
185
;;;
188
186
;;; MIME types
189
187
;;;
190
188
 
191
 
(defsubst mew-ct-textp (ct)
 
189
(defun mew-ct-textp (ct)
192
190
  (string-match "^Text" (capitalize ct)))
193
191
 
194
 
(defsubst mew-ct-imagep (ct)
 
192
(defun mew-ct-imagep (ct)
195
193
  (string-match "^Image" (capitalize ct)))
196
194
 
197
 
(defsubst mew-ct-modelp (ct)
 
195
(defun mew-ct-modelp (ct)
198
196
  (string-match "^Model" (capitalize ct)))
199
197
 
200
 
(defsubst mew-ct-multipartp (ct)
 
198
(defun mew-ct-multipartp (ct)
201
199
  (string-match "^Multipart" (capitalize ct)))
202
200
 
203
 
(defsubst mew-ct-messagep (ct)
 
201
(defun mew-ct-messagep (ct)
204
202
  (string-match "^Message" (capitalize ct)))
205
203
 
206
 
(defsubst mew-ct-linebasep (ct)
 
204
(defun mew-ct-linebasep (ct)
207
205
  (or (mew-ct-textp ct)
208
206
      (mew-case-equal ct mew-ct-aps)
209
207
      (mew-case-equal ct mew-ct-msg))) ;; xxx mew-ct-messagep?
219
217
;;;
220
218
 
221
219
(defconst mew-custom-type-of-field-completion
222
 
  '(alist key-type: string :value-type function))
 
220
  '(list (list string function)))
223
221
 
224
222
(defcustom mew-field-completion-switch
225
 
  '(("To:"          . mew-complete-address)
226
 
    ("Cc:"          . mew-complete-address)
227
 
    ("Dcc:"         . mew-complete-address)
228
 
    ("Bcc:"         . mew-complete-address)
229
 
    ("Reply-To:"    . mew-complete-address)
230
 
    ("Fcc:"         . mew-complete-local-folder)
231
 
    ("Resent-To:"   . mew-complete-address)
232
 
    ("Resent-Cc:"   . mew-complete-address)
233
 
    ("Resent-Dcc:"  . mew-complete-address)
234
 
    ("Resent-Bcc:"  . mew-complete-address)
235
 
    ("Resent-Fcc:"  . mew-complete-local-folder)
236
 
    ("Newsgroups:"  . mew-complete-newsgroups)
237
 
    ("Followup-To:" . mew-complete-newsgroups))
 
223
  '(("To:"          mew-complete-address)
 
224
    ("Cc:"          mew-complete-address)
 
225
    ("Dcc:"         mew-complete-address)
 
226
    ("Bcc:"         mew-complete-address)
 
227
    ("Reply-To:"    mew-complete-address)
 
228
    ("Fcc:"         mew-complete-local-folder)
 
229
    ("Resent-To:"   mew-complete-address)
 
230
    ("Resent-Cc:"   mew-complete-address)
 
231
    ("Resent-Dcc:"  mew-complete-address)
 
232
    ("Resent-Bcc:"  mew-complete-address)
 
233
    ("Resent-Fcc:"  mew-complete-local-folder)
 
234
    ("Newsgroups:"  mew-complete-newsgroups)
 
235
    ("Followup-To:" mew-complete-newsgroups))
238
236
  "*Completion function alist concerned with the key."
239
237
  :group 'mew-complete
240
238
  :type mew-custom-type-of-field-completion)
241
239
 
242
240
(defcustom mew-field-circular-completion-switch
243
 
  '(("To:"          . mew-circular-complete-domain)
244
 
    ("Cc:"          . mew-circular-complete-domain)
245
 
    ("Dcc:"         . mew-circular-complete-domain)
246
 
    ("Bcc:"         . mew-circular-complete-domain)
247
 
    ("Reply-To:"    . mew-circular-complete-domain)
248
 
    ("Resent-To:"   . mew-circular-complete-domain)
249
 
    ("Resent-Cc:"   . mew-circular-complete-domain)
250
 
    ("Resent-Dcc:"  . mew-circular-complete-domain)
251
 
    ("Resent-Bcc:"  . mew-circular-complete-domain)
252
 
    ("From:"        . mew-circular-complete-from)
253
 
    ("Resent-From:" . mew-circular-complete-from))
 
241
  '(("To:"          mew-circular-complete-domain)
 
242
    ("Cc:"          mew-circular-complete-domain)
 
243
    ("Dcc:"         mew-circular-complete-domain)
 
244
    ("Bcc:"         mew-circular-complete-domain)
 
245
    ("Reply-To:"    mew-circular-complete-domain)
 
246
    ("Resent-To:"   mew-circular-complete-domain)
 
247
    ("Resent-Cc:"   mew-circular-complete-domain)
 
248
    ("Resent-Dcc:"  mew-circular-complete-domain)
 
249
    ("Resent-Bcc:"  mew-circular-complete-domain)
 
250
    ("From:"        mew-circular-complete-from)
 
251
    ("Resent-From:" mew-circular-complete-from))
254
252
  "*Circular completion function alist concerned with the key."
255
253
  :group 'mew-complete
256
254
  :type mew-custom-type-of-field-completion)
257
255
 
258
256
(defcustom mew-field-expansion-switch
259
 
  '(("To:"         . mew-expand-address)
260
 
    ("Cc:"         . mew-expand-address)
261
 
    ("Dcc:"        . mew-expand-address)
262
 
    ("Bcc:"        . mew-expand-address)
263
 
    ("Reply-To:"   . mew-expand-address)
264
 
    ("Resent-To:"  . mew-expand-address)
265
 
    ("Resent-Cc:"  . mew-expand-address)
266
 
    ("Resent-Dcc:" . mew-expand-address)
267
 
    ("Resent-Bcc:" . mew-expand-address))
 
257
  '(("To:"         mew-expand-address)
 
258
    ("Cc:"         mew-expand-address)
 
259
    ("Dcc:"        mew-expand-address)
 
260
    ("Bcc:"        mew-expand-address)
 
261
    ("Reply-To:"   mew-expand-address)
 
262
    ("Resent-To:"  mew-expand-address)
 
263
    ("Resent-Cc:"  mew-expand-address)
 
264
    ("Resent-Dcc:" mew-expand-address)
 
265
    ("Resent-Bcc:" mew-expand-address))
268
266
  "*Expansion function alist concerned with the key."
269
267
  :group 'mew-complete
270
268
  :type mew-custom-type-of-field-completion)
271
269
 
272
 
(defsubst mew-field-get-func (key switch)
273
 
  (cdr (mew-assoc-match key switch 0)))
 
270
(defun mew-field-get-func (key switch)
 
271
  (mew-alist-get-value (mew-assoc-match key switch 0)))
274
272
 
275
273
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
276
274
;;;
282
280
 
283
281
(defvar mew-mime-content-type nil
284
282
  "\\<mew-summary-mode-map>Database for MIME content type.
285
 
This is a list of entries which consist of <content-type>, 
286
 
<regular expression of file suffix>, <content-transfer-encoding>, 
 
283
This is a list of entries which consist of <content-type>,
 
284
<regular expression of file suffix>, <content-transfer-encoding>,
287
285
<symbol for visualizer>, <symbol for icon>, <auxiliary data>.
288
286
 
289
287
Here is an example:
326
324
        Equivalent to (\"prog\" args async).
327
325
- (nil func2)
328
326
        (1) Displayed 'type \\[mew-summary-execute-external]'.
329
 
        (2) <func2> is called. 
 
327
        (2) <func2> is called.
330
328
- (func1 func2)
331
329
        (1) <func1> is called.
332
330
        (2) <func2> is called.
333
331
            If the original content-type is Application/Octet-Stream,
334
332
            you are asked to choose <func1> or <func2>.
335
333
- (func1 \"prog\")
336
 
        (1) <func1> is called. 
 
334
        (1) <func1> is called.
337
335
        (2) \"prog\" is executed asynchronously.
338
336
            If the original content-type is Application/Octet-Stream,
339
337
            you are asked to choose <func1> or \"prog\".
340
 
- (func1 (\"prog\" args async)) 
341
 
        (1) <func1> is called. 
 
338
- (func1 (\"prog\" args async))
 
339
        (1) <func1> is called.
342
340
        (2) \"prog\" is executed asynchronously with <args>.
343
341
            If the original content-type is Application/Octet-Stream,
344
342
            you are asked to choose <func1> or \"prog\".
345
343
 
346
344
Note that (1) indicates the action for '\\[mew-summary-display]' and
347
 
(2) indicates the action for '\\[mew-summary-execute-external]'.
 
345
\(2) indicates the action for '\\[mew-summary-execute-external]'.
348
346
 
349
347
If you want to add an entry for new content-type, please let the author
350
348
know. Such an entry should be shared by all users and be included in
351
349
the next version of Mew.")
352
350
 
353
 
(defsubst mew-ctdb-by-ct (ct)
 
351
(defun mew-ctdb-by-ct (ct)
354
352
  (mew-assoc-match2 ct mew-mime-content-type 0))
355
353
 
356
 
(defsubst mew-ctdb-by-file (file)
 
354
(defun mew-ctdb-by-file (file)
357
355
  (mew-assoc-match2 file mew-mime-content-type 1))
358
356
 
359
 
(defsubst mew-ctdb-ct (attr)
 
357
(defun mew-ctdb-ct (attr)
360
358
  (and (nth 0 attr) (mew-capitalize (nth 0 attr))))
361
359
 
362
 
(defsubst mew-ctdb-regex (attr)
 
360
(defun mew-ctdb-regex (attr)
363
361
  (nth 1 attr))
364
362
 
365
 
(defsubst mew-ctdb-cte (attr)
 
363
(defun mew-ctdb-cte (attr)
366
364
  (symbol-value (nth 2 attr)))
367
365
 
368
 
(defsubst mew-ctdb-prog (attr)
 
366
(defun mew-ctdb-prog (attr)
369
367
  (let ((val (symbol-value (nth 3 attr))))
370
368
    (if (and (listp val) (eq 'if (car val)))
371
369
        (eval val)
372
370
      val)))
373
371
 
374
 
(defsubst mew-ctdb-icon (attr)
 
372
(defun mew-ctdb-icon (attr)
375
373
  (symbol-value (nth 4 attr)))
376
374
 
377
 
(defsubst mew-mime-image-format-name (ct)
 
375
(defun mew-mime-image-format-name (ct)
378
376
  (nth 5 (mew-ctdb-by-ct ct)))
379
377
 
380
378
(defvar mew-mime-content-type-for-ooffice nil
394
392
    (t           "attachment" t))
395
393
  "(content-type inline/attachment filename)")
396
394
 
397
 
(defsubst mew-cdpdb-by-ct (ct)
 
395
(defun mew-cdpdb-by-ct (ct)
398
396
  (mew-assoc-match2 ct mew-mime-content-disposition 0))
399
397
 
400
 
(defsubst mew-cdpdb-val (attr)
 
398
(defun mew-cdpdb-val (attr)
401
399
  (nth 1 attr))
402
400
 
403
 
(defsubst mew-cdpdb-file (attr)
 
401
(defun mew-cdpdb-file (attr)
404
402
  (nth 2 attr))
405
403
 
406
404
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
419
417
    (smime-encryption ((,mew-ct-smm ,mew-ct-smm-enc)) "SE")
420
418
    (smime-signature-encryption
421
419
     ((,mew-ct-smm ,mew-ct-smm-sig) (,mew-ct-smm ,mew-ct-smm-enc)) "SSSE")
422
 
    (smie-encryption-signature
 
420
    (smime-encryption-signature
423
421
     ((,mew-ct-smm ,mew-ct-smm-enc) (,mew-ct-smm ,mew-ct-smm-sig)) "SESS"))
424
422
  "*Alist of key, a list of privacy Content-Type, and its mark."
425
423
  :group 'mew-privacy
426
424
  :type 'sexp)
427
425
 
428
 
(defsubst mew-pcdb-services ()
 
426
(defun mew-pcdb-services ()
429
427
  (mapcar 'car mew-privacy-database))
430
428
 
431
 
(defsubst mew-pcdb-by-service (service)
 
429
(defun mew-pcdb-by-service (service)
432
430
  (assq service mew-privacy-database))
433
431
 
434
 
(defsubst mew-pcdb-ct (pcdb)
 
432
(defun mew-pcdb-ct (pcdb)
435
433
  (nth 1 pcdb))
436
434
 
437
 
(defsubst mew-pcdb-mark (pcdb)
 
435
(defun mew-pcdb-mark (pcdb)
438
436
  (nth 2 pcdb))
439
437
 
440
438
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
445
443
(defvar mew-mime-multipart-alternative-list
446
444
  `(,mew-ct-txt ".*"))
447
445
 
448
 
(defsubst mew-multipart-alternative-preference (part)
 
446
(defun mew-multipart-alternative-preference (part)
449
447
  (let ((ct (mew-syntax-get-value (mew-syntax-get-ct part) 'cap)))
450
448
    (mew-member-match ct mew-mime-multipart-alternative-list)))
451
449
 
452
450
(defvar mew-mime-external-body-list
453
451
  '("anon-ftp" "url" "mail-server"))
454
452
 
455
 
(defsubst mew-mime-external-body-preference (part)
 
453
(defun mew-mime-external-body-preference (part)
456
454
  (let* ((ctl (mew-syntax-get-ct part))
457
455
         (ct (mew-syntax-get-value ctl 'cap))
458
456
         (access-type (mew-syntax-get-param ctl "access-type")))
489
487
    ("Dkim-Signature:"      unstruct unstruct)) ;; capitalized
490
488
  "(field enc dec)")
491
489
 
492
 
(defsubst mew-field-type-for-encoding (key)
 
490
(defun mew-field-type-for-encoding (key)
493
491
  (or (nth 1 (assoc (mew-capitalize key) mew-field-database)) 'unstruct))
494
492
 
495
 
(defsubst mew-field-type-for-decoding (key)
 
493
(defun mew-field-type-for-decoding (key)
496
494
  (or (nth 2 (assoc (mew-capitalize key) mew-field-database)) 'text))
497
495
 
498
496
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
561
559
     mew-face-header-private
562
560
     mew-face-header-marginal))
563
561
  "*An alist of field spec for Message mode. Each spec
564
 
consists of field-regular-expression, visible-p, face-for-key, 
565
 
and face-for-value. Fields whose visible-p is t are displayed in 
 
562
consists of field-regular-expression, visible-p, face-for-key,
 
563
and face-for-value. Fields whose visible-p is t are displayed in
566
564
Message mode in the defined order. Fields whose visible-p is nil are
567
565
hidden in Message mode. Type DEL to see them. Fields not matched
568
566
to field-regular-expressions are operated by the value of
569
 
'mew-field-other-visible'. If face-for-key is omitted, 
 
567
'mew-field-other-visible'. If face-for-key is omitted,
570
568
'mew-face-header-key' is used. If face-for-value is not
571
569
present, mew-face-header-marginal is used."
572
570
  :group 'mew-highlight
575
573
                  (choice (list boolean)
576
574
                          (list boolean face face))))
577
575
 
578
 
;; cons the position to the spec. 
579
 
(defsubst mew-nspec-by-key (key)
 
576
;; cons the position to the spec.
 
577
(defun mew-nspec-by-key (key)
580
578
  (mew-assoc-match3 key mew-field-spec 0))
581
579
 
582
 
(defsubst mew-nspec-n (nspec)
 
580
(defun mew-nspec-n (nspec)
583
581
  (nth 0 nspec))
584
582
 
585
 
(defsubst mew-nspec-visiblep (nspec)
 
583
(defun mew-nspec-visiblep (nspec)
586
584
  (nth 2 nspec))
587
585
 
588
 
(defsubst mew-nspec-keyface (nspec)
 
586
(defun mew-nspec-keyface (nspec)
589
587
  (nth 3 nspec))
590
588
 
591
 
(defsubst mew-nspec-valface (nspec)
 
589
(defun mew-nspec-valface (nspec)
592
590
  (nth 4 nspec))
593
591
 
594
 
(defsubst mew-nspec-extraface (nspec)
 
592
(defun mew-nspec-extraface (nspec)
595
593
  (nth 5 nspec))
596
594
 
597
595
(defun mew-authentication-results (val)
626
624
;;;
627
625
 
628
626
(defvar mew-highlight-mark-keywords
629
 
  `((,mew-mark-review . mew-face-mark-review)
630
 
    (,mew-mark-escape . mew-face-mark-escape)
631
 
    (,mew-mark-delete . mew-face-mark-delete)
632
 
    (,mew-mark-unlink . mew-face-mark-unlink)
633
 
    (,mew-mark-refile . mew-face-mark-refile)
634
 
    (,mew-mark-unread . mew-face-mark-unread))
 
627
  `((,mew-mark-review mew-face-mark-review)
 
628
    (,mew-mark-escape mew-face-mark-escape)
 
629
    (,mew-mark-delete mew-face-mark-delete)
 
630
    (,mew-mark-unlink mew-face-mark-unlink)
 
631
    (,mew-mark-refile mew-face-mark-refile)
 
632
    (,mew-mark-unread mew-face-mark-unread))
635
633
  "A list of mark-face pair to used in Summary/Virtual mode.")
636
634
 
637
 
(defsubst mew-highlight-mark-get-face (mark)
638
 
  (cdr (assoc mark mew-highlight-mark-keywords)))
 
635
(defun mew-highlight-mark-get-face (mark)
 
636
  (mew-alist-get-value (assoc mark mew-highlight-mark-keywords)))
639
637
 
640
638
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
641
639
;;;
655
653
 
656
654
0th (the first element of a list) is a mark value. A mark value is
657
655
ASCII code of the mark. For example, the value of the '*' mark
658
 
(mew-mark-review) is 42.
 
656
\(mew-mark-review) is 42.
659
657
 
660
658
Seven values following a mark value means as follows:
661
659
 
662
660
1st is the case of no mark.
663
661
2nd is the case where the new mark is equal to the old one.
664
 
3rd is the case where level of the new mark is greater than that of the 
 
662
3rd is the case where level of the new mark is greater than that of the
665
663
    old one.
666
664
4th, 5th, and 6th is the case where levels are equal.
667
665
    4th and 5th is the case that the old mark has state.
668
666
        4th means that the old mark is overrode.
669
667
        5th means that the old mark remains.
670
668
    6th is the case that the old mark does not have state.
671
 
7th is the case where level of the new mark is smaller than that of the 
 
669
7th is the case where level of the new mark is smaller than that of the
672
670
    old one.
673
671
 
674
672
The value of cursor actions means as follows:
675
673
 
676
674
        0 means staying.
677
675
        1 means moving according to the direction,
678
 
        2 means moving according to the direction 
 
676
        2 means moving according to the direction
679
677
          then displaying the next message.
680
678
 
681
679
For more detail, see mew-mark-put-mark and mew-mark-afterstep.")
682
680
 
683
 
(defsubst mew-markas-nth (mark case)
 
681
(defun mew-markas-nth (mark case)
684
682
  (nth case (assoc mark mew-mark-afterstep-spec)))
685
683
 
686
684
(defvar mew-mark-spec
693
691
    (,mew-mark-refile "refile" 2 t   mew-mark-kill-refile mew-mark-unrefile
694
692
                                     mew-mark-exec-refile mew-mark-sanity-refile))
695
693
  "*A list of lists which consists of
696
 
mark, name, level, statefullp, kill-line-p, 
 
694
mark, name, level, statefullp, kill-line-p,
697
695
undo-func, exec-func, and sanity-fucn.")
698
696
 
699
697
;;
702
700
  "Collecting all defined marks."
703
701
  (mapcar 'car mew-mark-spec))
704
702
 
705
 
(defsubst mew-markdb-by-mark (mark)
 
703
(defun mew-markdb-by-mark (mark)
706
704
  (assoc mark mew-mark-spec))
707
705
 
708
 
(defsubst mew-markdb-name (mark)
 
706
(defun mew-markdb-name (mark)
709
707
  (nth 1 (mew-markdb-by-mark mark)))
710
708
 
711
 
(defsubst mew-markdb-level (mark)
 
709
(defun mew-markdb-level (mark)
712
710
  (nth 2 (mew-markdb-by-mark mark)))
713
711
 
714
 
(defsubst mew-markdb-statefullp (mark)
 
712
(defun mew-markdb-statefullp (mark)
715
713
  (nth 3 (mew-markdb-by-mark mark)))
716
714
 
717
 
(defsubst mew-markdb-killp (mark)
 
715
(defun mew-markdb-killp (mark)
718
716
  (nth 4 (mew-markdb-by-mark mark)))
719
717
 
720
 
(defsubst mew-markdb-func-undo (mark)
 
718
(defun mew-markdb-func-undo (mark)
721
719
  (nth 5 (mew-markdb-by-mark mark)))
722
720
 
723
 
(defsubst mew-markdb-func-exec (mark)
 
721
(defun mew-markdb-func-exec (mark)
724
722
  (nth 6 (mew-markdb-by-mark mark)))
725
723
 
726
 
(defsubst mew-markdb-func-sanity (mark)
 
724
(defun mew-markdb-func-sanity (mark)
727
725
  (nth 7 (mew-markdb-by-mark mark)))
728
726
 
729
727
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
738
736
headers.
739
737
 
740
738
This value must be a list of entries. An entry is a list whose first
741
 
element is a field defined in 'mew-scan-fields'. 
 
739
element is a field defined in 'mew-scan-fields'.
742
740
 
743
741
If the second element is a list, the first element of the list must be
744
742
a mark (e.g. ?D) or a string which is a comma separated folders (e.g
750
748
Subject is \"daily log\" with 'o' to be refiled \"+log\". Also Mew
751
749
marks messages whose Content-Type: contains \"gb2312\" with 'D'.
752
750
 
753
 
(setq mew-inbox-action-alist
 
751
\(setq mew-inbox-action-alist
754
752
      '((\"Subject:\"
755
753
         (?D \"adult\" \"money\")
756
754
         (\"+log\" \"daily log\"))
763
761
If you are using 'spamassassin' which adds the \"X-Spam-Flag:\" field
764
762
to messages and puts them in your mailbox, configure as follows:
765
763
 
766
 
(setq mew-spam: \"X-Spam-Flag:\")
 
764
\(setq mew-spam: \"X-Spam-Flag:\")
767
765
 
768
 
(defun mew-spam-assassin (val)
 
766
\(defun mew-spam-assassin (val)
769
767
  (let ((case-fold-search t))
770
768
    (if (string-match \"yes\" val) ?D)))
771
769
 
772
 
(setq mew-inbox-action-alist
 
770
\(setq mew-inbox-action-alist
773
771
      '((\"X-Spam-Flag:\" mew-spam-assassin)))
774
772
 
775
773
With this configuration, messages with the \"X-Spam-Flag:\" whose
780
778
If you are using 'bogofilter' which adds the \"X-Bogosity:\" field
781
779
to messages and puts them to your mailbox, configure as follows:
782
780
 
783
 
(setq mew-spam: \"X-Bogosity:\")
 
781
\(setq mew-spam: \"X-Bogosity:\")
784
782
 
785
 
(defun mew-spam-bogofilter (val)
 
783
\(defun mew-spam-bogofilter (val)
786
784
  (let ((case-fold-search t))
787
785
    (if (string-match \"yes\" val) ?D)))
788
786
 
789
 
(setq mew-inbox-action-alist
 
787
\(setq mew-inbox-action-alist
790
788
      '((\"X-Bogosity:\" mew-spam-bogofilter)))
791
789
")
792
790
 
793
791
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
794
792
;;;
795
 
;;; External-body
796
 
;;;
797
 
 
798
 
(defvar mew-ext-url-alist
799
 
  '(("^application" "Fetch by w3" mew-ext-url-fetch-by-w3 nil)
800
 
    (t              "Browse by mozilla" "mozilla" ("-install")))
801
 
  "*Alist of (REGEXP DOC PROGRAM ARGS-LIST) to define
802
 
an appropriate method for a content-type in external-body. Note
803
 
this phantom body is defined RFC 2017.
804
 
 
805
 
If REGEXP is 't', every content-type is matched to the list.
806
 
If PROGRAM is a string, it is considered an external program.
807
 
If PROGRAM is a symbol, the lisp function whose name is PROGRAM is called.
808
 
 
809
 
'mew-ext-url-show-by-w3' and 'mew-ext-url-fetch-by-w3' are pre-defined
810
 
as lisp function.
811
 
 
812
 
If you want to use \"w3.el\" instead of \"mozilla\", configure like this:
813
 
        (setq mew-ext-url-alist
814
 
              '((t (\"Browse by w3\" mew-ext-url-show-by-w3 nil))))
815
 
If you want to use \"lynx\" instead of \"mozilla\", configure like this:
816
 
        (setq mew-ext-url-alist
817
 
              '((t (\"Browse by lynx\" \"kterm\" (\"-e\" \"lynx\" \"-color\")))))
818
 
")
819
 
 
820
 
(defsubst mew-ext-url-by-ct (ct)
821
 
  (mew-assoc-match2 ct mew-ext-url-alist 0))
822
 
 
823
 
(defsubst mew-ext-url-get-doc (prog-list)
824
 
  (nth 1 prog-list))
825
 
 
826
 
(defsubst mew-ext-url-get-prog (prog-list)
827
 
  (nth 2 prog-list))
828
 
 
829
 
(defsubst mew-ext-url-get-args (prog-list)
830
 
  (nth 3 prog-list))
831
 
 
832
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
833
 
;;;
834
793
;;; Proto
835
794
;;;
836
795
 
846
805
 
847
806
(defun mew-proto-to-body (fld n)
848
807
  (if (mew-folder-virtualp fld)
849
 
      (setq fld (mew-physical-folder fld)))
 
808
      (setq fld (mew-folder-basename fld)))
850
809
  (setq fld (mew-case:folder-folder fld))
851
810
  (let ((proto (mew-folder-prefix fld)))
852
811
    (unless (member proto mew-folder-prefixes)
868
827
   ((mew-folder-popp  proto) mew-pop-inbox-folder)
869
828
   ((mew-folder-imapp proto) (mew-imap-inbox-folder case))
870
829
   ((mew-folder-nntpp proto) (mew-nntp-newsgroup case))
871
 
   (t ;; local 
 
830
   (t ;; local
872
831
    (mew-inbox-folder case))))
873
832
 
874
833
(defun mew-proto-queue-folder (proto &optional case)
880
839
(defun mew-proto-friend-folder (proto &optional case)
881
840
  (cond
882
841
   ((mew-folder-imapp proto) (mew-imap-friend-folder case))
883
 
   (t ;; local 
 
842
   (t ;; local
884
843
    mew-friend-folder)))
885
844
 
886
845
(defun mew-proto-friend-folder-list (proto &optional case)
887
846
  (cond
888
847
   ((mew-folder-imapp proto) (mew-imap-friend-folder-list case))
889
 
   (t ;; local 
 
848
   (t ;; local
890
849
    (mew-local-friend-folder-list))))
891
850
 
892
851
(defun mew-proto-folder-alist (proto &optional case)
894
853
   ((mew-folder-popp  proto) (mew-pop-folder-alist))
895
854
   ((mew-folder-imapp proto) (mew-imap-folder-alist case))
896
855
   ((mew-folder-nntpp proto) (mew-nntp-folder-alist case))
897
 
   (t ;; local 
 
856
   (t ;; local
898
857
    (mew-local-folder-alist))))
899
858
 
900
859
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
903
862
;;;
904
863
 
905
864
(defcustom mew-config-alist nil
906
 
  "*Alist of config. This is a list of 
907
 
        (<case> (<key> . <value>) (<key> . <value>) ...).
 
865
  "*Alist of config. This is a list of
 
866
        (<case> (<key> <value>) (<key> <value>) ...).
908
867
  - <case> is a string of case.
909
 
  - <key> is a string of Mew value with the \"mew-\" prefix removed.
 
868
  - <key> is a symbol of Mew value with the 'mew-' prefix removed.
910
869
  - <value> is a string.
911
870
 
912
 
Currently, the following keys are supported: 
913
 
\"name\", \"user\", \"mail-domain\", 
914
 
\"cc\", \"fcc\", \"dcc\", \"reply-to\", \"organization\", \"header-alist\", 
915
 
\"proto\", 
916
 
\"smtp-server\", \"smtp-port\", \"smtp-ssh-server\", \"smtp-ssl\", \"smtp-ssl-port\", 
917
 
\"smtp-user\", \"smtp-auth-list\", 
918
 
\"smtp-msgid-user\", \"smtp-msgid-domain\", \"smtp-helo-domain\", \"smtp-mail-from\", 
919
 
\"pop-server\", \"pop-port\", \"pop-ssh-server\", \"pop-ssl\", \"pop-ssl-port\", 
920
 
\"pop-user\", \"pop-auth\", \"pop-auth-list\",
921
 
\"pop-size\", \"pop-body-lines\", \"pop-delete\", \"pop-body-lines\",
922
 
\"pop-proxy-server\", \"pop-proxy-port\",
923
 
\"imap-server\", \"imap-port\", \"imap-ssh-server\", \"imap-ssl\", \"imap-ssl-port\", 
924
 
\"imap-user\", \"imap-auth\", \"imap-auth-list\", 
925
 
\"imap-size\", \"imap-header-only\", \"imap-delete\", 
926
 
\"imap-trash-folder\", \"imap-queue-folder\", \"imap-spam-field\", \"imap-spam-word\",
927
 
\"imap-proxy-server\", \"imap-proxy-port\",
928
 
\"nntp-server\", \"nntp-port\", \"nntp-ssh-server\", \"nntp-ssl\", \"nntp-ssl-port\", 
929
 
\"nntp-user\", \"nntp-size\", \"nntp-header-only\", 
930
 
\"nntp-msgid-user\", \"nntp-msgid-domain\", 
931
 
\"ssl-cert-directory\", \"ssl-verify-level\", 
932
 
\"inbox-folder\", \"queue-folder\", \"postq-folder\", 
933
 
\"mailbox-type\", \"mbox-command\", \"mbox-command-arg\", 
934
 
\"signature-file\", \"content-type\", \"refile-guess-alist\",
935
 
\"spam-prog\", \"spam-prog-args\", \"ham-prog\", \"ham-prog-args\",
936
 
\"use-old-pgp\".
 
871
Currently, the following keys are supported:
 
872
name, user, mail-domain, 
 
873
cc, fcc, dcc, reply-to, organization, header-alist, proto, 
 
874
smtp-server, smtp-port, smtp-ssh-server, smtp-ssl, smtp-ssl-port, 
 
875
smtp-user, smtp-auth-list, 
 
876
smtp-msgid-user, smtp-msgid-domain, smtp-helo-domain, smtp-mail-from, 
 
877
pop-server, pop-port, pop-ssh-server, pop-ssl, pop-ssl-port, 
 
878
pop-user, pop-auth, pop-auth-list, 
 
879
pop-size, pop-header-only, pop-delete, pop-body-lines,
 
880
pop-proxy-server, pop-proxy-port,
 
881
imap-server, imap-port, imap-ssh-server, imap-ssl, imap-ssl-port, 
 
882
imap-user, imap-auth, imap-auth-list, 
 
883
imap-size, imap-header-only, imap-delete, 
 
884
imap-trash-folder, imap-queue-folder, imap-spam-field, imap-spam-word,
 
885
imap-proxy-server, imap-proxy-port,
 
886
nntp-server, nntp-port, nntp-ssh-server, nntp-ssl, nntp-ssl-port, 
 
887
nntp-user, nntp-size, nntp-header-only, 
 
888
nntp-msgid-user, nntp-msgid-domain, 
 
889
ssl-cert-directory, ssl-verify-level, 
 
890
inbox-folder, queue-folder, postq-folder, 
 
891
mailbox-type, mbox-command, mbox-command-arg,
 
892
signature-file, content-type, refile-guess-alist, 
 
893
spam-prog, spam-prog-args, ham-prog, ham-prog-args, 
 
894
use-old-pgp, pgp-signer, smime-signer, privacy-method, 
 
895
protect-privacy-always, protect-privacy-always-type, 
 
896
protect-privacy-encrypted, protect-privacy-encrypted-type, 
 
897
protect-privacy-with-old-pgp-signature
937
898
 
938
899
from = name <user@mail-domain>
939
900
message-id = *random*.smtp-msgid-user@smtp-msgid-domain
941
902
 
942
903
An example is as follows:
943
904
 
944
 
(setq mew-config-alist
945
 
      '((\"mew\"
946
 
         (\"mail-domain\"  . \"example.org\")
947
 
         (\"inbox-folder\" . \"+inbox-mew\"))
948
 
        (\"keio\"
949
 
         (\"cc\"           . \"kazu@example.jp\")
950
 
         (\"user\"         . \"pooh\")
951
 
         (\"mail-domain\"  . \"example.net\"))
952
 
        (\"default\"
953
 
         (\"name\"         . \"Kazu Yamamoto\")
954
 
         (\"mail-domain\"  . \"example.jp\"))))
 
905
\(setq mew-config-alist
 
906
      '((mew
 
907
         (mail-domain  \"example.org\")
 
908
         (inbox-folder \"+inbox-mew\"))
 
909
        (keio
 
910
         (cc           \"kazu@example.jp\")
 
911
         (user         \"pooh\")
 
912
         (mail-domain  \"example.net\"))
 
913
        (default
 
914
         (name         \"Kazu Yamamoto\")
 
915
         (mail-domain  \"example.jp\"))))
955
916
"
956
917
  :group 'mew-env
957
918
  :type '(alist :key-type string
958
919
                :value-type (repeat (cons string string))))
959
920
 
960
 
(defsubst mew-cfent-by-case (case)
 
921
(defun mew-cfent-by-case (case)
961
922
  (if (null case)
962
 
      (assoc mew-case-default mew-config-alist)
963
 
    (assoc case mew-config-alist)))
 
923
      (or (assoc mew-case-default mew-config-alist)
 
924
          (assoc (intern mew-case-default) mew-config-alist))
 
925
    (or (assoc case mew-config-alist)
 
926
        (assoc (intern case) mew-config-alist))))
964
927
 
965
928
(provide 'mew-vars2)
966
929
 
967
930
;;; Copyright Notice:
968
931
 
969
 
;; Copyright (C) 2000-2007 Mew developing team.
 
932
;; Copyright (C) 2000-2008 Mew developing team.
970
933
;; All rights reserved.
971
934
 
972
935
;; Redistribution and use in source and binary forms, with or without
973
936
;; modification, are permitted provided that the following conditions
974
937
;; are met:
975
 
;; 
 
938
;;
976
939
;; 1. Redistributions of source code must retain the above copyright
977
940
;;    notice, this list of conditions and the following disclaimer.
978
941
;; 2. Redistributions in binary form must reproduce the above copyright
981
944
;; 3. Neither the name of the team nor the names of its contributors
982
945
;;    may be used to endorse or promote products derived from this software
983
946
;;    without specific prior written permission.
984
 
;; 
 
947
;;
985
948
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
986
949
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
987
950
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR