+(defun webmail-my-deja-article-part (base)
+ (let (p)
+ (cond
+ ((looking-at "[\t\040\r\n]*<!--[^>]*>")
+ (replace-match ""))
+ ((looking-at "[\t\040\r\n]*</PRE>")
+ (replace-match ""))
+ ((looking-at "[\t\040\r\n]*<PRE>")
+ ;; text/plain
+ (replace-match "")
+ (save-restriction
+ (narrow-to-region (point)
+ (if (re-search-forward "</?PRE>" nil t)
+ (match-beginning 0)
+ (point-max)))
+ (goto-char (point-min))
+ (mm-url-remove-markup)
+ (mm-url-decode-entities-nbsp)
+ (goto-char (point-max))))
+ ((looking-at "[\t\040\r\n]*<TABLE")
+ (save-restriction
+ (narrow-to-region (point)
+ (if (search-forward "</TABLE>" nil t 2)
+ (point)
+ (point-max)))
+ (goto-char (point-min))
+ (let (name type url bufname)
+ (if (and (search-forward "File Name:" nil t)
+ (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t))
+ (setq name (match-string 1)))
+ (if (and (search-forward "File Type:" nil t)
+ (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t))
+ (setq type (match-string 1)))
+ (unless (re-search-forward "action=\"getattach\\.cgi/\\([^\"]+\\)"
+ nil t)
+ (webmail-error "article@5"))
+ (setq url (concat base "/getattach.cgi/" (match-string 1)
+ "?sm=Download"))
+ (while (re-search-forward
+ "type=hidden name=\"\\([^\"]+\\)\" value=\"\\([^\"]+\\)"
+ nil t)
+ (setq url (concat url "&" (match-string 1) "="
+ (match-string 2))))
+ (delete-region (point-min) (point-max))
+ (save-excursion
+ (set-buffer (generate-new-buffer " *webmail-att*"))
+ (mm-url-insert url)
+ (push (current-buffer) webmail-buffer-list)
+ (setq bufname (buffer-name)))
+ (insert "<#part type=\"" type "\"")
+ (if name (insert " filename=\"" name "\""))
+ (insert " buffer=\"" bufname "\"")
+ (insert " disposition=inline><#/part>"))))
+ (t
+ (insert "<#part type=\"text/html\" disposition=inline>")
+ (goto-char (point-max))
+ (insert "<#/part>")))))
+