~pkal/autocrypt

cf63019b3f58c8696b7251cde4087127557283a3 — Philip Kaludercic 6 months ago d8e34fc
Add a 'get-part' implementation for Gnus
1 files changed, 19 insertions(+), 0 deletions(-)

M autocrypt-gnus.el
M autocrypt-gnus.el => autocrypt-gnus.el +19 -0
@@ 19,6 19,8 @@
;;; Code:

(require 'gnus)
(require 'gnus-art)
(require 'mm-decode)
(require 'autocrypt)

;;;###autoload


@@ 34,6 36,23 @@
  "Return value for HEADER from current message."
  (gnus-fetch-original-field header))

(defun autocrypt-gnus--get-part (index)
  "Return the INDEX'th part of the message as a string."
  (save-window-excursion
    (let ((content nil))
      (condition-case nil
          (gnus-article-part-wrapper
           (1+ index)
           (lambda (&optional handle _arg _event)
             (unless handle
               (gnus-article-jump-to-part (1+ index))
               (setq handle (get-text-property (point) 'gnus-data)))
             (with-temp-buffer
               (mm-insert-part handle)
               (setq content (buffer-string)))))
        (error))
      content)))

(provide 'autocrypt-gnus)

;;; autocrypt-gnus.el ends here