Function: nnimap-change-group

nnimap-change-group is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-change-group GROUP &optional SERVER NO-RECONNECT READ-ONLY)

Documentation

Change group to GROUP if non-nil.

If SERVER is set, check that server is connected, otherwise retry to reconnect, unless NO-RECONNECT is set to t. Return nil if unsuccessful in connecting. If GROUP is nil, return t. If READ-ONLY is set, send EXAMINE rather than SELECT to the server. Return the server's response to the SELECT or EXAMINE command.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-change-group (group &optional server no-reconnect read-only)
  "Change group to GROUP if non-nil.
If SERVER is set, check that server is connected, otherwise retry
to reconnect, unless NO-RECONNECT is set to t.  Return nil if
unsuccessful in connecting.
If GROUP is nil, return t.
If READ-ONLY is set, send EXAMINE rather than SELECT to the server.
Return the server's response to the SELECT or EXAMINE command."
  (let ((open-result t))
    (when (and server
	       (not (nnimap-server-opened server)))
      (setq open-result (nnimap-open-server server nil no-reconnect)))
    (cond
     ((not open-result)
      nil)
     ((not group)
      t)
     (t
      (with-current-buffer (nnimap-buffer)
        (let ((result (nnimap-command "%s %S"
                                      (if read-only
                                          "EXAMINE"
                                        "SELECT")
                                      (nnimap-group-to-imap group))))
          (when (car result)
            (setf (nnimap-group nnimap-object) group
                  (nnimap-select-result nnimap-object) result)
            result)))))))