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

« back to all changes in this revision

Viewing changes to mew-draft.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:
44
44
  (setq comment-start mew-comment-start)
45
45
  (make-local-variable 'comment-start-skip)
46
46
  (setq comment-start-skip mew-comment-start-skip)
47
 
  (make-local-hook 'after-change-functions)
48
47
  (add-hook 'after-change-functions 'mew-draft-dynamic-highlight nil 'local)
49
48
  (if (boundp 'write-file-functions)
50
49
      (add-hook 'write-file-functions 'mew-encode-make-backup nil 'local)
54
53
    (make-local-variable 'require-final-newline)
55
54
    (setq require-final-newline t))
56
55
  (when (featurep 'dnd)
57
 
    (make-variable-buffer-local 'x-dnd-test-function)
58
 
    (make-variable-buffer-local 'dnd-protocol-alist)
59
 
    (setq x-dnd-test-function 'mew-draft-dnd-test-function)
 
56
    (make-local-variable 'dnd-protocol-alist)
60
57
    (setq dnd-protocol-alist
61
58
          (append '(("^file:///" . mew-draft-dnd-handle-local-file)
62
59
                    ("^file://"  . mew-draft-dnd-handle-file)
64
61
                  dnd-protocol-alist))))
65
62
 
66
63
(defun mew-draft-mode (&optional encrypted)
67
 
  "\\<mew-draft-mode-map>
68
 
Mew Draft mode:: major mode for composing a MIME message.
69
 
Key actions are different in each region: Header, Body, and Attachment.
70
 
 
71
 
To send a draft, type \\[mew-draft-make-message] and \\[mew-draft-send-message].  To make multipart, type
72
 
\\[mew-draft-prepare-attachments], edit attachments, type \\[mew-draft-make-message] and \\[mew-draft-send-message].
73
 
 
74
 
*Whole buffer key assignment:
75
 
 
76
 
\\[mew-draft-make-message]      Compose a MIME message then put it into a queue folder.
77
 
\\[mew-draft-send-message]      Compose a MIME message then send it.
78
 
 
79
 
\\[mew-draft-prepare-attachments]       Prepare an attachment region in the bottom of the draft.
80
 
        To compose a multipart message, you should execute this 
81
 
        command first.
82
 
 
83
 
\\[mew-draft-set-case]  Guess case and set the case for output to it.
84
 
\\[mew-draft-rehighlight]  Highlight header and body again.
85
 
 
86
 
\\[mew-draft-kill]      Kill this draft.
87
 
 
88
 
\\[mew-pgp-sign-message]        Sign the entire draft with PGP. Input your passphrase.
89
 
\\[mew-pgp-encrypt-message]     Encrypt the entire draft with PGP.
90
 
\\[mew-pgp-sign-encrypt-message]        Sign then encrypt the entire draft with PGP.
91
 
        Input your passphrase.
92
 
\\[mew-pgp-encrypt-sign-message]        Encrypt then sign the entire draft with PGP.
93
 
        Input your passphrase.
94
 
 
95
 
\\[mew-draft-toggle-privacy-always]     Toggle whether or not all drafts are protected.
96
 
\\[mew-draft-toggle-privacy-encrypted]  Toggle whether or not drafts replying to encrypted messages 
97
 
                are protected.
98
 
\\[mew-draft-set-privacy-type]  Set privacy service which will be effective when \\[mew-draft-make-message].
99
 
\\<mew-draft-header-map>
100
 
*Header region key assignment:
101
 
 
102
 
\\[mew-draft-header-comp]       Complete field keys.
103
 
        Complete and expand an address short name.
104
 
        Complete folder names.
105
 
\\[mew-draft-circular-comp]     Complete your mail domain.
106
 
\\[mew-draft-expand]    Replace an address with 'NAME <address>'.
107
 
 
108
 
*Body region key assignment:
109
 
 
110
 
\\<mew-draft-body-map>\\[mew-draft-insert-signature]    Insert '~/.signature' on the cursor point.
111
 
\\<mew-draft-mode-map>\\[mew-draft-cite]        Copy and paste a part of message from Message mode with
112
 
        citation prefix and label.
113
 
        1. Roughly speaking, it copies the body in Message mode. 
114
 
           For example, if text/plain is displayed, the entire Message 
115
 
           mode is copied. If message/rfc822 is displayed, the body 
116
 
           without the header is copied.
117
 
        2. If called with '\\[universal-argument]', the header is also copied if exists.
118
 
        3. If an Emacs mark exists, the target is the region between 
119
 
           the mark and the cursor.
120
 
\\[mew-draft-yank]      Copy and paste a part of message from Message mode WITHOUT
121
 
        citation prefix and label.
122
 
 
123
 
*Attachments region Key assignment:
124
 
\\<mew-draft-attach-map>
125
 
\\[mew-attach-forward]  Go to the first subdirectory.
126
 
\\[mew-attach-backforward]      Go to the parent directory.
127
 
\\[mew-attach-next]     Go to the next file in the current directory.
128
 
\\[mew-attach-previous] Go to the previous file in the current directory.
129
 
 
130
 
\\[mew-attach-copy]     Copy a file (via networks) on '.'.
131
 
        To copy a remote file, use the '/[user@]hostname:/filepath' syntax.
132
 
\\[mew-attach-link]     Link a file with a symbolic link on '.'.
133
 
\\[mew-attach-link-message]     Link the message displayed in Message mode with a symbolic link on '.'.
134
 
\\[mew-attach-delete]   Delete this file or this directory.
135
 
\\[mew-attach-multipart]        Create a subdirectory(i.e. multipart) on '.'.
136
 
\\[mew-attach-find-file]        Open this file into a buffer.
137
 
\\[mew-attach-find-new-file]    Open a new file into a buffer on '.'.
138
 
\\[mew-attach-external-body]    Input external-body on '.'.
139
 
\\[mew-attach-audio]    Sampling voice and insert as audio file on '.'.
140
 
\\[mew-attach-pgp-public-key]   Extract the PGP key for the specified user on '.'.
141
 
\\[mew-attach-description]      Input a description(Content-Description:).
142
 
\\[mew-attach-disposition]      Change the file name(Content-Disposition:).
143
 
\\[mew-attach-type]     Change the data type(Content-Type:).
144
 
\\[mew-attach-charset]  Specify the charset parameter for a Text/* object.
145
 
\\[mew-attach-icharset] Specify a input coding-system for a text file.
146
 
 
147
 
\\[mew-attach-base64]   Put the 'B' mark to encode with Base64.
148
 
\\[mew-attach-quoted-printable] Put the 'Q' mark to encode with Quoted-Printable.
149
 
\\[mew-attach-gzip64]   Put the 'G' mark to encode with Gzip64. This is applicable 
150
 
        only to Text/Plain and Application/Postscript since compression 
151
 
        is not effective other objects. For example, JPEG is already 
152
 
        compressed.
153
 
\\[mew-attach-pgp-sign] Put the 'PS' mark to sign with PGP.
154
 
\\[mew-attach-pgp-enc]  Put the 'PE' mark to encrypt with PGP. 
155
 
        Input decryptors' addresses.
156
 
\\[mew-attach-undo]     Unmark. The original mark appears.
157
 
 
158
 
* Fill blanks
159
 
\\<mew-draft-mode-map>
160
 
Prepare '~/.mew-fib' like;
161
 
 
162
 
        name:  Kazuhiko Yamamoto
163
 
        email: kazu@example.org
164
 
 
165
 
If you receive a message like;
166
 
 
167
 
        Your name : |>name<|
168
 
        Your e-mail address: |>email<|
169
 
 
170
 
Type \\<mew-summary-mode-map>\\[mew-summary-reply] in Summary mode to enter Draft mode. 
171
 
Then type \\<mew-draft-mode-map>\\[mew-draft-yank], \\[mew-fib-fill-default], and \\[mew-fib-delete-frame] makes following
172
 
draft.
173
 
 
174
 
        Your name : Kazuhiko Yamamoto
175
 
        Your e-mail address: kazu@example.org
176
 
 
177
 
In this way, mew-fil fills up items quoted like |> <| from '~/.mew-fib'.
178
 
The fill functions described below.
179
 
 
180
 
\\[mew-fib-fill-default]        Fill |>item<| from '~/.mew-fib'.
181
 
\\[mew-fib-delete-frame]        Delete all quotations, i.e. |> <|.
182
 
\\[mew-fib-next-item]   Jump to the next fib item.
183
 
\\[mew-fib-previous-item]       Jump to the previous fib item.
184
 
\\[mew-fib-flush-input] Flush input from '~/.mew-fib'.
185
 
 
186
 
Moreover, '~/.mew-fib' supports aliases like;
187
 
 
188
 
        email: kazu@example.org
189
 
        e-mail:
190
 
 
191
 
"
 
64
  "A major mode for composing a MIME message.
 
65
 
 
66
\\{mew-draft-mode-map}"
192
67
  (interactive)
193
68
  (setq major-mode 'mew-draft-mode)
194
69
  (setq mode-line-buffer-identification mew-mode-line-id)
195
 
  (mew-draft-mode-name)
196
70
  (mew-draft-set-local-variables)
197
71
  (use-local-map mew-draft-mode-map)
198
72
  (set-syntax-table mew-draft-mode-syntax-table)
202
76
  (mew-tinfo-set-encrypted-p encrypted)
203
77
  (mew-tinfo-set-privacy-err nil)
204
78
  (mew-tinfo-set-privacy-type nil)
 
79
  (mew-draft-mode-name) ;; must be after (mew-tinfo-set-encrypted-p encrypted)
205
80
  (run-hooks 'text-mode-hook 'mew-draft-mode-hook)
206
81
  ;; auto-fill-function is set by mew-draft-mode-hook
207
82
  (when auto-fill-function
210
85
  (setq buffer-undo-list nil))
211
86
 
212
87
(defun mew-draft-mode-name (&optional header)
213
 
  (let (pcdb sub)
 
88
  (let ((case (mew-tinfo-get-case))
 
89
        pcdb sub)
214
90
    (cond
215
91
     ((or (mew-tinfo-get-privacy-type) (mew-tinfo-get-privacy-err))
216
92
      ;; If privacy err, don't display mew-protect-privacy-always-type etc.
217
93
      (setq pcdb (mew-pcdb-by-service (mew-tinfo-get-privacy-type)))
218
94
      (setq sub (mew-pcdb-mark pcdb)))
219
 
     ((and (mew-tinfo-get-encrypted-p) mew-protect-privacy-encrypted)
220
 
      (setq pcdb (mew-pcdb-by-service mew-protect-privacy-encrypted-type))
 
95
     ((and (mew-tinfo-get-encrypted-p) (mew-protect-privacy-encrypted case))
 
96
      (setq pcdb (mew-pcdb-by-service (mew-protect-privacy-encrypted-type case)))
221
97
      (setq sub (mew-pcdb-mark pcdb)))
222
 
     (mew-protect-privacy-always
223
 
      (setq pcdb (mew-pcdb-by-service mew-protect-privacy-always-type))
 
98
     ((mew-protect-privacy-always case)
 
99
      (setq pcdb (mew-pcdb-by-service (mew-protect-privacy-always-type case)))
224
100
      (setq sub (mew-pcdb-mark pcdb))))
225
101
    (setq mode-name (if header mew-mode-name-header mew-mode-name-draft))
226
102
    (if sub (setq mode-name (concat mode-name " " sub)))
274
150
      (setq switch-func 'switch-to-buffer))
275
151
     ((eq switch-func t)
276
152
      (setq switch-func 'switch-to-buffer-other-window)))
277
 
    (mew-frwlet
278
 
     mew-cs-m17n mew-cs-dummy
279
 
     (funcall switch-func (mew-find-file-noselect draft-path)))
 
153
    (mew-frwlet mew-cs-m17n mew-cs-dummy
 
154
      (funcall switch-func (mew-find-file-noselect draft-path)))
280
155
    ;; draft buffer
281
156
    (mew-set-buffer-cs mew-cs-m17n)
282
157
    ;; copy config, first
299
174
the Body: field."
300
175
  (let ((case-fold-search t)
301
176
        key val ret)
302
 
    (while halist
303
 
      (setq key (car (car halist)))
304
 
      (setq val (cdr (car halist)))
305
 
      (setq halist (cdr halist))
 
177
    (dolist (ent halist)
 
178
      (setq key (mew-alist-get-key ent))
 
179
      (setq val (mew-alist-get-value ent))
306
180
      (unless (string-match ":$" key)
307
181
        (setq key (concat key ":")))
308
182
      (if (string-match mew-body: key)
311
185
    ret))
312
186
 
313
187
(defun mew-insert-address-list (field adrs del force-insert)
314
 
  (let ((cnt 0) (beg (point)) med adr)
315
 
    (while adrs
316
 
      (setq adr (car adrs) adrs (cdr adrs))
 
188
  (let ((cnt 0) (beg (point)) med)
 
189
    (dolist (adr adrs)
317
190
      (unless (mew-is-my-address del adr)
318
191
        (if (= cnt 0)
319
192
            (insert adr)
336
209
      (setq med (point))
337
210
      (insert (car adrs))
338
211
      (setq adrs (cdr adrs))
339
 
      (while adrs
340
 
        (insert ", " (car adrs))
341
 
        (setq adrs (cdr adrs)))
 
212
      (dolist (adr adrs)
 
213
        (insert ", " adr))
342
214
      (insert "\n")
343
215
      (mew-header-fold-region beg (point) med 'use-tab))))
344
216
 
373
245
       ((listp to)
374
246
        (setq del (mew-insert-address-list mew-to: to del t))))
375
247
      (cond
376
 
       ((null cc) ()) ;; do nothing 
 
248
       ((null cc) ()) ;; do nothing
377
249
       ((stringp cc) ;; Cc: specified from the mini-buffer.
378
250
        (mew-draft-header-insert mew-cc: cc))
379
251
       ((listp cc) ;; Cc: collected by reply.
393
265
    (unless newsgroups
394
266
      (mew-draft-header-insert mew-in-reply-to: in-reply-to))
395
267
    (mew-draft-header-insert mew-references: references)
396
 
    (if (and mew-x-face-file
397
 
             (file-exists-p (expand-file-name mew-x-face-file)))
398
 
        (let (xface)
399
 
          (with-temp-buffer
400
 
            (mew-insert-file-contents (expand-file-name mew-x-face-file))
401
 
            (setq xface (mew-buffer-substring (point-min)
402
 
                                              (max (buffer-size) 1))))
403
 
          (mew-draft-header-insert mew-x-face: xface)))
 
268
    (mew-draft-header-insert-xface)
404
269
    (mew-draft-header-insert mew-organization: (mew-organization case))
405
270
    (setq body (mew-draft-header-insert-alist other-headers))
406
271
    ;; Deleting fields defined in mew-header-alist to replace them.
407
 
    (mew-header-delete-lines (mapcar 'car (mew-header-alist case)))
 
272
    (mew-header-delete-lines (mapcar 'mew-alist-get-value (mew-header-alist case)))
408
273
    (mew-header-goto-end)
409
274
    (mew-draft-header-insert-alist (mew-header-alist case))
410
275
    ;; X-Mailer: must be the last
418
283
    (goto-char (point-min))
419
284
    (search-forward ": " nil t)))
420
285
 
 
286
(defun mew-draft-header-insert-xface ()
 
287
  (if (and mew-x-face-file
 
288
           (file-exists-p (expand-file-name mew-x-face-file)))
 
289
      (let (xface)
 
290
        (with-temp-buffer
 
291
          (mew-insert-file-contents (expand-file-name mew-x-face-file))
 
292
          (setq xface (mew-buffer-substring (point-min)
 
293
                                            (max (buffer-size) 1))))
 
294
        (mew-draft-header-insert mew-x-face: xface))))
 
295
 
421
296
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
422
297
;;;
423
298
;;; Citation
440
315
   if text/plain is displayed, the entire Message mode is copied.
441
316
   If message/rfc822 is displayed, the body without the header is copied.
442
317
2. If called with '\\[universal-argument]', the header is also copied if exists.
443
 
3. If an Emacs mark exists, the target is the region between the mark and 
 
318
3. If an Emacs mark exists, the target is the region between the mark and
444
319
   the cursor."
445
320
;; MUST take care of C-x C-x
446
321
;; MUST be able to cancel by C-x u
459
334
          (widen)
460
335
          (let ((mark-active t))
461
336
            (cond
462
 
             (arg 
 
337
             (arg
463
338
              (setq beg (point-min) end (point-max)))
464
339
             ((and (not mew-cite-ignore-region)
465
340
                   (mew-mark)
491
366
   if text/plain is displayed, the entire Message mode is copied.
492
367
   If message/rfc822 is displayed, the body without the header is copied.
493
368
2. If called with '\\[universal-argument]', the header is also copied if exists.
494
 
3. If an Emacs mark exists, the target is the region between the mark and 
 
369
3. If an Emacs mark exists, the target is the region between the mark and
495
370
   the cursor."
496
371
;; MUST take care of C-x C-x
497
372
;; MUST be able to cancel by C-x u
499
374
  (if (and (not force) (or (mew-in-header-p) (mew-in-attach-p)))
500
375
      (message "Cannot cite a message here")
501
376
    (let* ((nonmewbuf mew-message-citation-buffer) ;; may be buffer local
502
 
           (fid (or mew-message-citation-frame-id (mew-frame-id))) 
 
377
           (fid (or mew-message-citation-frame-id (mew-frame-id)))
503
378
           (fld (mew-current-get-fld fid))
504
379
           (msg (mew-current-get-msg fid))
505
380
           (msg-buf (mew-buffer-message))
550
425
        (save-restriction
551
426
          (widen)
552
427
          (mew-header-goto-end)
553
 
          (setq cite (concat (mew-buffer-substring (point-min) (point)) 
 
428
          (setq cite (concat (mew-buffer-substring (point-min) (point))
554
429
                             "\n" cite))
555
430
          (setq irt-msgid (mew-idstr-get-first-id
556
431
                           (mew-header-get-value mew-message-id:)))))
557
 
      ;; 
 
432
      ;;
558
433
      ;; Draft mode, insert the header and the body.
559
434
      ;;
560
435
 
602
477
          (setq prefix mew-cite-prefix)
603
478
        (setq prefix (funcall mew-cite-prefix-function)))
604
479
      (if mew-cite-prefix-confirmp
605
 
          (let ((ask (read-string 
 
480
          (let ((ask (read-string
606
481
                      (format "Prefix (\"%s\"): " prefix) "")))
607
482
            (if (not (string= ask "")) (setq prefix ask))))
608
483
      ;; C-u C-c C-y cites body with header.
609
 
      (if (eq arg nil) 
 
484
      (if (eq arg nil)
610
485
          ;; header has been already cited. So, delete it.
611
486
          (delete-region beg (progn (mew-header-goto-body) (point))))
612
487
      (insert label)
626
501
    (or value "")))
627
502
 
628
503
(defun mew-cite-strings ()
629
 
  "A function to create cite labels according to 
 
504
  "A function to create cite labels according to
630
505
'mew-cite-format' and 'mew-cite-fields'."
631
506
  (if (null mew-cite-fields)
632
507
      ""
646
521
            (while (not (eobp))
647
522
              (cond
648
523
               ((eq mew-draft-cite-fill-mode 'truncate)
649
 
                (end-of-line)            
 
524
                (end-of-line)
650
525
                (if (>= fill-column (current-column))
651
526
                    ()
652
527
                  (setq eol (point))
659
534
                (end-of-line)
660
535
                (if (= (current-column) 0)
661
536
                    ()
662
 
                  (fill-region beg (point))
663
 
                  (if (= (current-column) 0) ;; for XEmacs
664
 
                      (delete-backward-char 1)))))
 
537
                  (fill-region beg (point)))))
665
538
              (forward-line)))
666
539
          (buffer-string))))))
667
540
 
719
592
(defun mew-draft-insert-signature (&optional arg)
720
593
  "Insert the signature file specified by mew-signature-file.
721
594
If attachments exist and mew-signature-as-lastpart is *non-nil*,
722
 
the file is attached to the last part. Otherwise, the file is 
 
595
the file is attached to the last part. Otherwise, the file is
723
596
inserted into the body. If mew-signature-insert-last is *non-nil*,
724
597
the file is inserted to the end of the body. Otherwise, inserted
725
598
the cursor position. If executed with '\\[universal-argument]',
747
620
              (mew-syntax-set-cdp syntax nil)
748
621
              (mew-syntax-set-cd  syntax mew-signature-description))
749
622
            (mew-encode-syntax-print mew-encode-syntax))
750
 
        (when mew-signature-insert-last 
 
623
        (when mew-signature-insert-last
751
624
          (if (null (mew-attach-p))
752
625
              (goto-char (point-max))
753
626
            (goto-char (1- (mew-attach-begin))))
758
631
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
759
632
;;;
760
633
;;; Re-highlight
761
 
;;; 
 
634
;;;
762
635
 
763
636
(defun mew-draft-rehighlight-body ()
764
637
  (save-excursion
789
662
  (mew-draft-mode-name))
790
663
 
791
664
(defun mew-draft-toggle-privacy-encrypted ()
792
 
  "Toggle whether or not drafts replying to encrypted messages are 
 
665
  "Toggle whether or not drafts replying to encrypted messages are
793
666
protected."
794
667
  (interactive)
795
668
  (setq mew-protect-privacy-encrypted (not mew-protect-privacy-encrypted))
991
864
;;; Privacy
992
865
;;;
993
866
 
994
 
(defvar mew-draft-privacy-method 'pgp)
 
867
(defvar mew-draft-privacy-method-alist '(("pgp" . pgp) ("smime" . smime)))
 
868
 
 
869
(defun mew-draft-set-privacy-method ()
 
870
  "Set mew-draft-privacy-method. 'pgp or 'smime."
 
871
  (interactive)
 
872
  (let ((method (completing-read "Privacy method: " mew-draft-privacy-method-alist nil t)))
 
873
    (setq mew-draft-privacy-method
 
874
          (cdr (assoc method mew-draft-privacy-method-alist)))))
 
875
 
 
876
(defmacro mew-draft-privacy-switch (&rest form)
 
877
  `(let ((method (mew-draft-privacy-method (mew-tinfo-get-case))))
 
878
     (cond
 
879
      ,@(mapcar
 
880
         (lambda (x)
 
881
           (if (eq (car x) t)
 
882
               x
 
883
             `((eq method ',(car x)) ,(car (cdr x)))))
 
884
         form)
 
885
      (t (message "'%s' is not supported" method)))))
995
886
 
996
887
(defun mew-draft-sign-message (&optional arg)
997
888
  "Sign the entire draft. Input your passphrase."
998
889
  (interactive "P")
999
 
  (cond
1000
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'pgp)
1001
 
    (mew-pgp-sign-message arg))
1002
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'smime)
1003
 
    (mew-smime-sign-message arg))
1004
 
   (t
1005
 
    (message "'%s' is not supported" (mew-draft-privacy-method (mew-tinfo-get-case))))))
 
890
  (mew-draft-privacy-switch
 
891
   (pgp   (mew-pgp-sign-message arg))
 
892
   (smime (mew-smime-sign-message arg))))
1006
893
 
1007
894
(defun mew-draft-encrypt-message ()
1008
895
  "Encrypt the entire draft with PGP."
1009
896
  (interactive)
1010
 
  (cond
1011
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'pgp)
1012
 
    (mew-pgp-encrypt-message))
1013
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'smime)
1014
 
    (mew-smime-encrypt-message))
1015
 
   (t
1016
 
    (message "'%s' is not supported" (mew-draft-privacy-method (mew-tinfo-get-case))))))
 
897
  (mew-draft-privacy-switch
 
898
   (pgp   (mew-pgp-encrypt-message))
 
899
   (smime (mew-smime-encrypt-message))))
1017
900
 
1018
901
(defun mew-draft-sign-encrypt-message (&optional arg)
1019
902
  "Sign then encrypt the entire draft. Input your passphrase."
1020
903
  (interactive "P")
1021
 
  (cond
1022
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'pgp)
1023
 
    (mew-pgp-sign-encrypt-message arg))
1024
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'smime)
1025
 
    (mew-smime-sign-encrypt-message arg))
1026
 
   (t
1027
 
    (message "'%s' is not supported" (mew-draft-privacy-method (mew-tinfo-get-case))))))
1028
 
 
 
904
  (mew-draft-privacy-switch
 
905
   (pgp   (mew-pgp-sign-encrypt-message arg))
 
906
   (smime (mew-smime-sign-encrypt-message arg))))
1029
907
 
1030
908
(defun mew-draft-encrypt-sign-message (&optional arg)
1031
909
  "Encrypt then sign the entire draft. Input your passphrase."
1032
910
  (interactive "P")
1033
 
  (cond
1034
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'pgp)
1035
 
    (mew-pgp-encrypt-sign-message arg))
1036
 
   ((eq (mew-draft-privacy-method (mew-tinfo-get-case)) 'smime)
1037
 
    (mew-smime-encrypt-sign-message arg))
1038
 
   (t
1039
 
    (message "'%s' is not supported" (mew-draft-privacy-method (mew-tinfo-get-case))))))
 
911
  (mew-draft-privacy-switch
 
912
   (pgp   (mew-pgp-encrypt-sign-message arg))
 
913
   (smime (mew-smime-encrypt-sign-message arg))))
1040
914
 
1041
915
(provide 'mew-draft)
1042
916
 
1043
917
;;; Copyright Notice:
1044
918
 
1045
 
;; Copyright (C) 1996-2007 Mew developing team.
 
919
;; Copyright (C) 1996-2008 Mew developing team.
1046
920
;; All rights reserved.
1047
921
 
1048
922
;; Redistribution and use in source and binary forms, with or without
1049
923
;; modification, are permitted provided that the following conditions
1050
924
;; are met:
1051
 
;; 
 
925
;;
1052
926
;; 1. Redistributions of source code must retain the above copyright
1053
927
;;    notice, this list of conditions and the following disclaimer.
1054
928
;; 2. Redistributions in binary form must reproduce the above copyright
1057
931
;; 3. Neither the name of the team nor the names of its contributors
1058
932
;;    may be used to endorse or promote products derived from this software
1059
933
;;    without specific prior written permission.
1060
 
;; 
 
934
;;
1061
935
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
1062
936
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1063
937
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR