-(defun gnus-html-curl-sentinel (process event)
- (when (string-match "finished" event)
- (let* ((images (gnus-process-get process 'images))
- (buffer (gnus-process-get process 'buffer))
- (spec (pop images))
- (file (gnus-html-image-id (car spec))))
- (when (and (buffer-live-p buffer)
- ;; If the position of the marker is 1, then that
- ;; means that the text it was in has been deleted;
- ;; i.e., that the user has selected a different
- ;; article before the image arrived.
- (not (= (marker-position (cadr spec)) (point-min))))
- (with-current-buffer buffer
- (let ((inhibit-read-only t)
- (string (buffer-substring (cadr spec) (caddr spec))))
- (delete-region (cadr spec) (caddr spec))
- (gnus-html-put-image file (cadr spec) string))))
+(defun gnus-html-image-fetched (status buffer images)
+ (let ((spec (pop images)))
+ (when (and (buffer-live-p buffer)
+ ;; If the position of the marker is 1, then that
+ ;; means that the text it was in has been deleted;
+ ;; i.e., that the user has selected a different
+ ;; article before the image arrived.
+ (not (= (marker-position (cadr spec)) (point-min))))
+ (let ((file (gnus-html-image-id (car spec))))
+ ;; Search the start of the image data
+ (search-forward "\n\n")
+ ;; Write region (image) silently
+ (write-region (point) (point-max) file nil 1)
+ (kill-buffer)
+ (with-current-buffer buffer
+ (let ((inhibit-read-only t)
+ (string (buffer-substring (cadr spec) (caddr spec))))
+ (delete-region (cadr spec) (caddr spec))
+ (gnus-html-put-image file (cadr spec) string))))