2001-02-09 08:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 9 Feb 2001 13:42:27 +0000 (13:42 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 9 Feb 2001 13:42:27 +0000 (13:42 +0000)
* mm-decode.el (mm-merge-handles): New function.

* mm-view.el (mm-inline-message): Use it.
(mm-view-message): Ditto.

* mm-partial.el (mm-inline-partial): Ditto.

* mm-extern.el (mm-inline-external-body): Ditto.

* gnus-art.el (gnus-mime-view-part): Ditto.
(gnus-mime-view-part-as-type): Ditto.
(gnus-mime-save-part-and-strip): Prevent users to strip in some
cases.

lisp/ChangeLog
lisp/gnus-art.el
lisp/mm-decode.el
lisp/mm-extern.el
lisp/mm-partial.el
lisp/mm-view.el

index 9de1f65..3cfd7a3 100644 (file)
@@ -1,3 +1,19 @@
+2001-02-09 08:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * mm-decode.el (mm-merge-handles): New function.
+
+       * mm-view.el (mm-inline-message): Use it.
+       (mm-view-message): Ditto.
+       
+       * mm-partial.el (mm-inline-partial): Ditto.
+
+       * mm-extern.el (mm-inline-external-body): Ditto.
+
+       * gnus-art.el (gnus-mime-view-part): Ditto.
+       (gnus-mime-view-part-as-type): Ditto.
+       (gnus-mime-save-part-and-strip): Prevent users to strip in some
+       cases.
+
 2001-02-08 20:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * message.el (message-cancel-news): Allow to shoot foot.
index 5aaa2b7..9b8c1ac 100644 (file)
@@ -3278,8 +3278,10 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   (interactive)
   (gnus-article-check-buffer)
   (let* ((data (get-text-property (point) 'gnus-data))
-        (file (and data (mm-save-part data)))
-        param)
+        file param)
+    (if (mm-multiple-handles gnus-article-mime-handles)
+       (error "This function is not implemented."))
+    (setq file (and data (mm-save-part data)))
     (when file
       (with-current-buffer (mm-handle-buffer data)
        (erase-buffer)
@@ -3354,7 +3356,9 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
     (when data
-      (push (setq data (copy-sequence data)) gnus-article-mime-handles)
+      (setq gnus-article-mime-handles
+           (mm-merge-handles
+            gnus-article-mime-handles (setq data (copy-sequence data))))
       (mm-interactively-view-part data))))
 
 (defun gnus-mime-view-part-as-type-internal ()
@@ -3386,7 +3390,8 @@ If ALL-HEADERS is non-nil, no headers are hidden."
                            (mm-handle-description handle)
                            (mm-handle-cache handle)
                            (mm-handle-id handle)))
-      (push handle gnus-article-mime-handles)
+      (setq gnus-article-mime-handles
+           (mm-merge-handles gnus-article-mime-handles handle))
       (gnus-mm-display-part handle))))
 
 (defun gnus-mime-copy-part (&optional handle)
index 1ca8067..93b5103 100644 (file)
@@ -1111,6 +1111,19 @@ If RECURSIVE, search recursively."
      (t nil))
     parts))
 
+(defun mm-multiple-handles (handles)
+   (and (listp (car handles)) 
+       (> (length handles) 1)))
+
+(defun mm-merge-handles (handles1 handles2) 
+  (append
+   (if (listp (car handles1)) 
+       handles1
+     (list handles1))
+   (if (listp (car handles2))
+       handles2
+     (list handles2))))
+
 (provide 'mm-decode)
 
 ;;; mm-decode.el ends here
index 5e58a12..ec5c9b1 100644 (file)
@@ -1,5 +1,5 @@
 ;;; mm-extern.el --- showing message/external-body
-;; Copyright (C) 2000 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: message external-body
@@ -25,7 +25,7 @@
 
 ;;; Code:
 
-(eval-when-compile 
+(eval-when-compile
   (require 'cl))
 
 (require 'mm-util)
 ;;;###autoload
 (defun mm-inline-external-body (handle &optional no-display)
   "Show the external-body part of HANDLE.
-This function replaces the buffer of HANDLE with a buffer contains 
+This function replaces the buffer of HANDLE with a buffer contains
 the entire message.
 If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
-  (let* ((access-type (cdr (assq 'access-type 
+  (let* ((access-type (cdr (assq 'access-type
                                 (cdr (mm-handle-type handle)))))
-        (func (cdr (assq (intern 
-                          (downcase 
+        (func (cdr (assq (intern
+                          (downcase
                            (or access-type
                                (error "Couldn't find access type."))))
                          mm-extern-function-alist)))
@@ -144,10 +144,8 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
            (unless good
              (mm-destroy-parts handles))))
        (mm-handle-set-cache handle handles))
-      (if (listp (car gnus-article-mime-handles))
-         (push handles gnus-article-mime-handles)
-       (setq gnus-article-mime-handles
-             (list handles gnus-article-mime-handles))))
+      (setq gnus-article-mime-handles
+           (mm-merge-handles gnus-article-mime-handles handles)))
     (unless no-display
       (save-excursion
        (save-restriction
index 38986c4..d05283c 100644 (file)
@@ -1,5 +1,5 @@
 ;;; mm-partial.el --- showing message/partial
-;; Copyright (C) 2000 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: message partial
@@ -25,7 +25,7 @@
 
 ;;; Code:
 
-(eval-when-compile 
+(eval-when-compile
   (require 'cl))
 
 (require 'gnus-sum)
     (while (setq header (pop headers))
       (unless (eq (aref header 0) art)
        (mm-with-unibyte-buffer
-         (gnus-request-article-this-buffer (aref header 0) 
+         (gnus-request-article-this-buffer (aref header 0)
                                            gnus-newsgroup-name)
          (when (search-forward id nil t)
            (let ((nhandles (mm-dissect-buffer)) nid)
              (if (consp (car nhandles))
                  (mm-destroy-parts nhandles)
-               (setq nid (cdr (assq 'id 
+               (setq nid (cdr (assq 'id
                                     (cdr (mm-handle-type nhandles)))))
                (if (not (equal id nid))
                    (mm-destroy-parts nhandles)
 ;;;###autoload
 (defun mm-inline-partial (handle &optional no-display)
   "Show the partial part of HANDLE.
-This function replaces the buffer of HANDLE with a buffer contains 
+This function replaces the buffer of HANDLE with a buffer contains
 the entire message.
 If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
-  (let ((id (cdr (assq 'id (cdr (mm-handle-type handle))))) 
+  (let ((id (cdr (assq 'id (cdr (mm-handle-type handle)))))
        phandles
        (b (point)) (n 1) total
        phandle nn ntotal
@@ -68,37 +68,34 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
       (unless id
        (error "Can not find message/partial id."))
       (setq phandles
-           (sort (cons handle 
+           (sort (cons handle
                        (mm-partial-find-parts
-                        id 
+                        id
                         (save-excursion
                           (set-buffer gnus-summary-buffer)
                           (gnus-summary-article-number))))
                  #'(lambda (a b)
-                     (let ((anumber (string-to-number 
-                                     (cdr (assq 'number 
+                     (let ((anumber (string-to-number
+                                     (cdr (assq 'number
                                                 (cdr (mm-handle-type a))))))
-                           (bnumber (string-to-number 
-                                     (cdr (assq 'number 
+                           (bnumber (string-to-number
+                                     (cdr (assq 'number
                                                 (cdr (mm-handle-type b)))))))
                        (< anumber bnumber)))))
       (setq gnus-article-mime-handles
-           (append (if (listp (car gnus-article-mime-handles))
-                       gnus-article-mime-handles
-                     (list gnus-article-mime-handles))
-                   phandles))
+           (mm-merge-handles gnus-article-mime-handles phandles))
       (save-excursion
        (set-buffer (generate-new-buffer " *mm*"))
        (while (setq phandle (pop phandles))
-         (setq nn (string-to-number 
-                   (cdr (assq 'number 
+         (setq nn (string-to-number
+                   (cdr (assq 'number
                               (cdr (mm-handle-type phandle))))))
-         (setq ntotal (string-to-number 
-                       (cdr (assq 'total 
+         (setq ntotal (string-to-number
+                       (cdr (assq 'total
                                   (cdr (mm-handle-type phandle))))))
          (if ntotal
              (if total
-                 (unless (eq total ntotal) 
+                 (unless (eq total ntotal)
                  (error "The numbers of total are different."))
                (setq total ntotal)))
          (unless (< nn n)
@@ -118,7 +115,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
            (error "Missing part %d" n))
        (kill-buffer (mm-handle-buffer handle))
        (goto-char (point-min))
-       (let ((point (if (search-forward "\n\n" nil t) 
+       (let ((point (if (search-forward "\n\n" nil t)
                         (1- (point))
                       (point-max))))
          (goto-char (point-min))
@@ -138,11 +135,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
          (when handles
            ;; It is in article buffer.
            (setq gnus-article-mime-handles
-                 (nconc (if (listp (car gnus-article-mime-handles))
-                          gnus-article-mime-handles
-                          (list gnus-article-mime-handles))
-                        (if (listp (car handles)) 
-                            handles (list handles)))))
+                 (mm-merge-handles gnus-article-mime-handles handles)))
          (mm-handle-set-undisplayer
           handle
           `(lambda ()
index 11026f9..639c32e 100644 (file)
       (setq handles gnus-article-mime-handles))
     (when handles
       (setq gnus-article-mime-handles
-           (nconc gnus-article-mime-handles
-                  (if (listp (car handles))
-                      handles (list handles))))))
+           (mm-merge-handles gnus-article-mime-handles handles))))
   (fundamental-mode)
   (goto-char (point-min)))
 
        (insert "----------\n\n")
        (when handles
          (setq gnus-article-mime-handles
-               (nconc gnus-article-mime-handles
-                      (if (listp (car handles))
-                          handles (list handles)))))
+               (mm-merge-handles gnus-article-mime-handles handles)))
        (mm-handle-set-undisplayer
         handle
         `(lambda ()