+(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
+ (when (file-writable-p (car articles))
+ (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.
+ (ignore-errors
+ (delete-directory nnmh-current-directory)))
+ ;; 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)
+ (let ((new-dir (nnmail-group-pathname new-name nnmh-directory))
+ (old-dir (nnmail-group-pathname group nnmh-directory)))
+ (when (ignore-errors
+ (make-directory new-dir t)
+ t)
+ ;; We move the articles file by file instead of renaming
+ ;; the directory -- there may be subgroups in this group.
+ ;; One might be more clever, I guess.
+ (let ((files (nnheader-article-to-file-alist old-dir)))
+ (while files
+ (rename-file
+ (concat old-dir (cdar files))
+ (concat new-dir (cdar files)))
+ (pop files)))
+ (when (<= (length (directory-files old-dir)) 2)
+ (ignore-errors
+ (delete-directory old-dir)))
+ ;; That went ok, so we change the internal structures.
+ (let ((entry (assoc group nnmh-group-alist)))
+ (when entry
+ (setcar entry new-name))
+ (setq nnmh-current-directory nil)
+ t))))
+
+(nnoo-define-skeleton nnmh)
+