Function: nnmairix-request-set-mark

nnmairix-request-set-mark is a byte-compiled function defined in nnmairix.el.gz.

Signature

(nnmairix-request-set-mark GROUP ACTIONS &optional SERVER)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnmairix.el.gz
(deffoo nnmairix-request-set-mark (group actions &optional server)
  (when server
    (nnmairix-open-server server))
  (let* ((qualgroup (gnus-group-prefixed-name group (list 'nnmairix nnmairix-current-server)))
	 (propmarks (gnus-group-get-parameter qualgroup 'propmarks))
	 ;; (propto (gnus-group-get-parameter qualgroup 'propto t))
	 (corr (nnmairix-get-numcorr group server))
	 (folder (nnmairix-get-backend-folder group server)))
    (save-excursion
      (dolist (cur actions)
	(let ((type (nth 1 cur))
	      (cmdmarks (nth 2 cur))
	      (range (range-uncompress (nth 0 cur)))
	      mid ogroup temp) ;; number method
	  (when (and corr
		     (not (zerop (cadr corr))))
	    (setq range (mapcar (lambda (arg)
				  (- arg (cadr corr)))
				range)))
	  (when propmarks
	    (nnheader-message 7 "nnmairix: Setting marks...")
	      (dolist (article range)
		;; get article (header) and extract message id
		;; we try to determine as many original articles as possible
		(catch 'problem
		  (nnmairix-call-backend "open-server" nnmairix-backend-server)
		  (unless (gnus-request-head
			   article
			   (gnus-group-prefixed-name
			    folder
			    (list nnmairix-backend nnmairix-backend-server)))
		    (nnheader-message
		     3 "Unable to set mark: couldn't fetch article header for article number %d"
		     article)
		    (throw 'problem nil))
		  (set-buffer nntp-server-buffer)
		  (goto-char (point-min))
		  (let ((case-fold-search t))
		    (re-search-forward "^message-id:.*\\(<.+>\\)" nil t))
		  (setq mid (match-string 1))
		  (unless mid
		    (nnheader-message
		     3 "Unable to set mark: article number %d has no message-id header"
		     article)
		    (throw 'problem nil))
		  ;; get original group. First try registry, then file path
		  (setq ogroup
			(nnmairix-determine-original-group-from-registry mid))
		  (unless (or ogroup
			      nnmairix-only-use-registry)
		    (setq ogroup
			  (nnmairix-determine-original-group-from-path
			   mid nnmairix-current-server)))
		  (unless ogroup
		    (nnheader-message
		     3 "Unable to set mark: couldn't find original group for %s" mid)
		    (throw 'problem nil))
		  ;; store original groups with mid's. We cannot get
		  ;; the article number immediately since this would
		  ;; generate problems with maildir (articles might
		  ;; get moved from /new to /cur and further marks
		  ;; could then not be set)
		  (dolist (cur ogroup)
		    (setq temp (assoc cur
				      nnmairix-marks-cache))
		    (if temp
			(nconc temp (list (list mid type cmdmarks)))
		      (push (list cur (list mid type cmdmarks))
			    nnmairix-marks-cache)))))
	      (nnheader-message 7 "nnmairix: Setting marks... done")))))))