Function: nnimap-process-quirk

nnimap-process-quirk is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-process-quirk GREETING-MATCH TYPE DATA)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-process-quirk (greeting-match type data)
  (when (and (nnimap-greeting nnimap-object)
	     (string-match greeting-match (nnimap-greeting nnimap-object))
	     (eq type 'append)
	     (string-search "\000" data))
    (let ((choice (gnus-multiple-choice
		   "Message contains NUL characters.  Delete, continue, abort? "
		   '((?d "Delete NUL characters")
		     (?c "Try to APPEND the message as is")
		     (?a "Abort")))))
      (cond
       ((eq choice ?a)
	(nnheader-report 'nnimap "Aborted APPEND due to NUL characters"))
       ((eq choice ?c)
	data)
       (t
	(with-temp-buffer
	  (insert data)
	  (goto-char (point-min))
	  (while (search-forward "\000" nil t)
	    (replace-match "" t t))
	  (buffer-string)))))))