+(deffoo nnmh-request-create-group (group &optional server)
+ (nnmail-activate 'nnmh)
+ (or (assoc group nnmh-group-alist)
+ (let (active)
+ (setq nnmh-group-alist (cons (list group (setq active (cons 1 0)))
+ nnmh-group-alist))
+ (nnmh-possibly-create-directory group)
+ (nnmh-possibly-change-directory group server)
+ (let ((articles (mapcar
+ (lambda (file)
+ (string-to-int file))
+ (directory-files
+ nnmh-current-directory nil "^[0-9]+$"))))
+ (and articles
+ (progn
+ (setcar active (apply 'min articles))
+ (setcdr active (apply 'max articles)))))))
+ t)
+
+(deffoo nnmh-request-delete-group (group &optional force server)
+ (nnmh-possibly-change-directory group server)
+ ;; Delete all articles in GROUP.
+ (if (not force)
+ () ; Don't delete the articles.
+ (let ((articles (directory-files nnmh-current-directory t "^[0-9]+$")))
+ (while articles
+ (and (file-writable-p (car articles))
+ (progn
+ (nnheader-message 5 "Deleting article %s in %s..."
+ (car articles) group)
+ (funcall nnmail-delete-file-function (car articles))))
+ (setq articles (cdr articles))))
+ ;; Try to delete the directory itself.
+ (condition-case ()
+ (delete-directory nnmh-current-directory)
+ (error nil)))
+ ;; Remove the group from all structures.
+ (setq nnmh-group-alist
+ (delq (assoc group nnmh-group-alist) nnmh-group-alist)
+ nnmh-current-directory nil)
+ t)
+
+(deffoo nnmh-request-rename-group (group new-name &optional server)
+ (nnmh-possibly-change-directory group server)
+ ;; Rename directory.
+ (and (file-writable-p nnmh-current-directory)
+ (condition-case ()
+ (progn
+ (rename-file
+ (directory-file-name nnmh-current-directory)
+ (directory-file-name
+ (nnmail-group-pathname new-name nnmh-directory)))
+ t)
+ (error nil))
+ ;; That went ok, so we change the internal structures.
+ (let ((entry (assoc group nnmh-group-alist)))
+ (and entry (setcar entry new-name))
+ (setq nnmh-current-directory nil)
+ t)))
+