Function: newsticker--image-download-by-url-callback

newsticker--image-download-by-url-callback is a byte-compiled function defined in newst-backend.el.gz.

Signature

(newsticker--image-download-by-url-callback STATUS FEED-NAME DIRECTORY FILENAME)

Documentation

Callback function for newsticker--image-download-by-url.

STATUS is the return status as delivered by url-retrieve. FEED-NAME is the name of the feed that the news were retrieved from. The image is saved in DIRECTORY as FILENAME.

Source Code

;; Defined in /usr/src/emacs/lisp/net/newst-backend.el.gz
(defun newsticker--image-download-by-url-callback (status feed-name directory filename)
  "Callback function for `newsticker--image-download-by-url'.
STATUS is the return status as delivered by `url-retrieve'.
FEED-NAME is the name of the feed that the news were retrieved
from.
The image is saved in DIRECTORY as FILENAME."
  (let ((do-save
         (or (not status)
             ;; (let ((status-type (car status)))
             ;;   (cond ((eq status-type :redirect)
             ;;          ;; don't care about redirects
             ;;          t)
             ;;         ((eq status-type :error)
             ;;          ;; silently ignore errors
             ;;          nil)))
             (eq (car status) :redirect))))
    (when do-save
      (let ((buf (get-buffer-create (concat " *newsticker-url-image-" feed-name "-"
                                            directory "*")))
            (result (buffer-string)))
        (set-buffer buf)
        (erase-buffer)
        (newsticker--insert-bytes result)
        ;; remove MIME header
        (goto-char (point-min))
        (search-forward "\n\n")
        (delete-region (point-min) (point))
        ;; save
        (newsticker--image-save buf directory filename)))))