Function: gnus-agent-synchronize-group-flags

gnus-agent-synchronize-group-flags is a byte-compiled function defined in gnus-agent.el.gz.

Signature

(gnus-agent-synchronize-group-flags GROUP ACTIONS SERVER)

Documentation

Update a plugged group by performing the indicated actions.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-agent.el.gz
;;;
;;; Internal functions
;;;

(defun gnus-agent-synchronize-group-flags (group actions server)
  "Update a plugged group by performing the indicated actions."
  (let* ((gnus-command-method (gnus-server-to-method server))
	 (info
	  ;; This initializer is required as gnus-request-set-mark
	  ;; calls gnus-group-real-name to strip off the host name
	  ;; before calling the backend.  Now that the backend is
	  ;; trying to call gnus-request-set-mark, I have to
	  ;; reconstruct the original group name.
	  (or (gnus-get-info group)
	      (gnus-get-info
	       (setq group (gnus-group-full-name
			    group gnus-command-method))))))
    (gnus-request-set-mark group actions)

    (when info
      (dolist (action actions)
	(let ((range (nth 0 action))
	      (what  (nth 1 action))
	      (marks (nth 2 action)))
	  (dolist (mark marks)
	    (cond ((eq mark 'read)
		   (setf (gnus-info-read info)
			 (funcall (if (eq what 'add)
				      #'range-concat
				    #'range-remove)
				  (gnus-info-read info)
				  range))
		   (gnus-get-unread-articles-in-group
		    info
		    (gnus-active (gnus-info-group info))))
		  ((memq mark '(tick))
		   (let ((info-marks (assoc mark (gnus-info-marks info))))
		     (unless info-marks
                       (push (setq info-marks (list mark))
                             (gnus-info-marks info)))
                     (setcdr info-marks
                             (funcall (if (eq what 'add)
                                          #'range-concat
                                        #'range-remove)
                                      (cdr info-marks)
                                      range))))))))

      ;; Marks can be synchronized at any time by simply toggling from
      ;; unplugged to plugged.  If that is what is happening right now,
      ;; make sure that the group buffer is up to date.
      (when (gnus-buffer-live-p gnus-group-buffer)
        (gnus-group-update-group group t)))
    nil))