From 95ac1119b9c72786e13c16fb13bf42c539531337 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 16 Dec 2010 18:02:06 +0100 Subject: [PATCH] Notify backends when we add/kill groups. --- lisp/ChangeLog | 11 +++++++++++ lisp/gnus-group.el | 5 ++++- lisp/gnus-int.el | 12 ++++++++++++ lisp/gnus-srvr.el | 3 ++- lisp/nnimap.el | 9 +++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f1b869770..5409d3e04 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2010-12-16 Lars Magne Ingebrigtsen + * gnus-group.el (gnus-group-kill-group): Notify the backend that the + group has been killed. + (gnus-group-yank-group): Ditto. + + * gnus-srvr.el (gnus-browse-unsubscribe-group): Ditto. + + * nnimap.el (nnimap-request-update-group-status): New function. + + * gnus-int.el (gnus-request-update-group-status): New interface + function. + * gnus-sum.el (gnus-summary-push-marks-to-backend): Fix the logic for copying read-ness to the backends. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index 5ece14571..73eeb7104 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -3781,6 +3781,7 @@ of groups killed." gnus-list-of-killed-groups)) (gnus-group-change-level (if entry entry group) gnus-level-killed (if entry nil level)) + (gnus-request-update-group-status group 'unsubscribe) (message "Killed group %s" (gnus-group-decoded-name group))) ;; If there are lots and lots of groups to be killed, we use ;; this thing instead. @@ -3803,7 +3804,8 @@ of groups killed." (setq gnus-zombie-list (delete group gnus-zombie-list)))) ;; There may be more than one instance displayed. (while (gnus-group-goto-group group) - (gnus-delete-line))) + (gnus-delete-line)) + (gnus-request-update-group-status group 'unsubscribe)) (gnus-make-hashtable-from-newsrc-alist)) (gnus-group-position-point) @@ -3831,6 +3833,7 @@ yanked) a list of yanked groups is returned." (and prev (gnus-group-entry prev)) t) (gnus-group-insert-group-line-info group) + (gnus-request-update-group-status group 'subscribe) (gnus-undo-register `(when (gnus-group-goto-group ,group) (gnus-group-kill-group 1)))) diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el index 432845401..71a9aa9e6 100644 --- a/lisp/gnus-int.el +++ b/lisp/gnus-int.el @@ -473,6 +473,18 @@ If FETCH-OLD, retrieve all headers (or some subset thereof) in the group." (funcall (gnus-get-function gnus-command-method 'request-type) (gnus-group-real-name group) article)))) +(defun gnus-request-update-group-status (group status) + "Change the status of a group. +Valid statuses include `subscribe' and `unsubscribe'." + (let ((gnus-command-method (gnus-find-method-for-group group))) + (if (not (gnus-check-backend-function + 'request-update-group-status (car gnus-command-method))) + nil + (funcall + (gnus-get-function gnus-command-method 'request-update-group-status) + (gnus-group-real-name group) status + (nth 1 gnus-command-method))))) + (defun gnus-request-set-mark (group action) "Set marks on articles in the back end." (let ((gnus-command-method (gnus-find-method-for-group group))) diff --git a/lisp/gnus-srvr.el b/lisp/gnus-srvr.el index 19fd5fe66..2ace2b3fe 100644 --- a/lisp/gnus-srvr.el +++ b/lisp/gnus-srvr.el @@ -992,7 +992,8 @@ how new groups will be entered into the group buffer." ;; mechanism for new group subscription. (gnus-call-subscribe-functions gnus-browse-subscribe-newsgroup-method - group))) + group) + (gnus-request-update-group-status group 'subscribe))) (delete-char 1) (insert (let ((lvl (gnus-group-level group))) (cond diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 6ea2c14d7..4eb904eaf 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -900,6 +900,15 @@ textual parts.") (push flag flags))) flags)) +(deffoo nnimap-request-update-group-status (group status &optional server) + (when (nnimap-possibly-change-group nil server) + (let ((command (assoc + status + '((subscribe "SUBSCRIBE") + (unsubscribe "UNSUBSCRIBE"))))) + (when command + (nnimap-command "%s %S" command (utf7-encode group t)))))) + (deffoo nnimap-request-set-mark (group actions &optional server) (when (nnimap-possibly-change-group group server) (let (sequence) -- 2.25.1