summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2023-10-12 21:55:52 -0400
committerSacha Chua <sacha@sachachua.com>2023-10-12 21:55:52 -0400
commitb9e2c5c9ba75422869c0f67d45f3093aac569261 (patch)
treeff303643f9fde3846792f7fcd878d7acc3715a4d
parentc151587d8c9ddb582dbe3cf7aa5fa1e2d0fdf78a (diff)
downloademacsconf-el-b9e2c5c9ba75422869c0f67d45f3093aac569261.tar.xz
emacsconf-el-b9e2c5c9ba75422869c0f67d45f3093aac569261.zip
formatting, save attachments
-rw-r--r--emacsconf-mail.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/emacsconf-mail.el b/emacsconf-mail.el
index 269d1e7..2e44d9b 100644
--- a/emacsconf-mail.el
+++ b/emacsconf-mail.el
@@ -353,7 +353,7 @@ insert into the current buffer instead of drafting e-mails."
(error "Could not find template %s" id)))))))))
(defun emacsconf-mail-parse-submission (body)
- "Extract data from EmacsConf 2023 submissions in BODY."
+ "Extract data from EmacsConf submissions in BODY."
(when (listp body) (setq body (plist-get (car body) :content)))
(let* ((data (list :body body))
(fields '((:title "^[* ]*Talk title")
@@ -401,8 +401,7 @@ insert into the current buffer instead of drafting e-mails."
(point-max))))))))
(if (string-match "[0-9]+" (or (plist-get data :format) ""))
(plist-put data :time (match-string 0 (or (plist-get data :format) ""))))
- data)
-))
+ data)))
;; Documented in https://sachachua.com/blog/2023/09/emacsconf-capturing-submissions-from-e-mails/
;;;###autoload
@@ -1042,5 +1041,24 @@ ${signature}")
files
"\n")))))
+(defun emacsconf-mail-notmuch-save-attachments-to-backstage (talk)
+ "Save the attached files to the cache and backstage dir for TALK."
+ (interactive (list (emacsconf-complete-talk-info)))
+ (with-current-notmuch-show-message
+ (notmuch-foreach-mime-part
+ (lambda (part)
+ (when (string= (car (mm-handle-disposition part)) "attachment")
+ (prin1 part)
+ (let* ((filename (or (mail-content-type-get
+ (mm-handle-disposition part) 'filename)
+ (mail-content-type-get
+ (mm-handle-type part) 'name)))
+ (extra (read-string (concat filename ": ")))
+ (new-filename (concat (plist-get talk :file-prefix)
+ extra "." (file-name-extension filename))))
+ (mm-save-part-to-file part (expand-file-name new-filename emacsconf-cache-dir))
+ (mm-save-part-to-file part (expand-file-name new-filename emacsconf-backstage-dir)))))
+ (mm-dissect-buffer))))
+
(provide 'emacsconf-mail)
;;; emacsconf-mail.el ends here