From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/9594 Path: main.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.gnus.general Subject: new back-end interface to fix article move/delete problems Date: 23 Jan 1997 23:03:50 -0500 Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035149595 19381 80.91.224.250 (20 Oct 2002 21:33:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 21:33:15 +0000 (UTC) Return-Path: Original-Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.8.5/8.8.5) with SMTP id UAA16877 for ; Thu, 23 Jan 1997 20:20:44 -0800 Original-Received: from cs.bu.edu (root@CS.BU.EDU [128.197.13.2]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Fri, 24 Jan 1997 05:03:56 +0100 Original-Received: from csb.bu.edu by cs.bu.edu (8.8.4/Spike-2.1) id XAA28822; Thu, 23 Jan 1997 23:03:52 -0500 (EST) Original-Received: by csb.bu.edu (8.8.3/Spike-2.1) id XAA22795; Thu, 23 Jan 1997 23:03:50 -0500 (EST) Original-To: ding@ifi.uio.no Original-Lines: 288 X-Mailer: Red Gnus v0.81/Emacs 19.34 Xref: main.gmane.org gmane.emacs.gnus.general:9594 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:9594 Dear fellow Gnusians (of any color, but Red preferred), I have recently done a great deal of reimplementation to fix some problems in using the mail-back-end commands to move, crosspost, and delete articles that are crossposted inside the mail back end. This work involves a new back-end interface *-request-modify-article which subsumes the functionality of the *-request-move-article, *-request-accept-article, and *-request-replace-article interfaces. I have shown my changes to Lars and he seems happy with them. Unfortunately, I have only implemented the back-end portion of my changes for the nnml back end. So I would like to recruit Gnus-loving people to implement this interface for the other back ends. I have written most of the nnml implementation in a manner that does not actually depend on nnml. Unfortunately, I don't understand nnoo well enough to make these functions available in that way. I also don't use the other back ends which makes it difficult for me to test my changes. I have enclosed a description of the new back-end interface and some of the changes I have made below. -- Joe Wells ---------------------------------------------------------------------- SPECIFICATION OF *-request-modify-article INTERFACE `(nnchoke-request-modify-article SERVER OLD-GROUP-ARTICLE NEW-GROUP-ARTICLE BUFFER &optional DONT-SAVE DONT-ADD-EXTRAS-TO-NEW)' Replaces the article specified by SERVER and OLD-GROUP-ARTICLE with one specified by NEW-GROUP-ARTICLE and BUFFER (and SERVER). This may involve removing the article from some old groups and adding (crossposting) it to some new groups. SERVER must be a string identifying an opened virtual server in the nnchoke back end. OLD-GROUP-ARTICLE is an alist whose members are of the form (GROUP-NAME . ARTICLE-NUMBER). The group names must be distinct from each other and must not include any server prefix. Each group must already exist in the server. Collectively, the group names and article numbers must belong to a single cross-posted article in the server. OLD-GROUP-ARTICLE is automatically extended to include all other existing group/article pairs reachable by Xref header links from articles already mentioned in OLD-GROUP-ARTICLE. (Call these additional group/article pairs the "extra" pairs.) OLD-GROUP-ARTICLE may be empty (indicating that a new article is being created). NEW-GROUP-ARTICLE is an alist whose members are of the form (GROUP-NAME . ARTICLE-NUMBER) or (GROUP-NAME . nil). The group names must be distinct from each other and must not include any server prefix. If any of the named groups do not exist, they will be created. For each (GROUP-NAME . XXX) pair in NEW-GROUP-ARTICLE, one of the following must be true: 1. (GROUP-NAME . XXX) is a member of OLD-GROUP-ARTICLE. 2. GROUP-NAME does not appear in OLD-GROUP-ARTICLE and either: a. XXX is an article number not already used in group GROUP-NAME. b. XXX is nil (indicating an unused article number in group GROUP-NAME should be allocated). NEW-GROUP-ARTICLE may be empty (causing only deletions of the article to occur). NEW-GROUP-ARTICLE is automatically extended so as to include the "extra" group/article pairs mentioned above. NEW-GROUP-ARTICLE may be just t or contain the element t in addition to its ordinary alist pairs. In this case, a list of groups will be added in place of the t based on nnmail-split-methods and the contents of BUFFER. For each additional group not already in NEW-GROUP-ARTICLE, a new pair (GROUP-NAME . ART-NUM) or (GROUP-NAME . nil) is added, depending on whether such a pair is in OLD-GROUP-ARTICLE. Either BUFFER names a buffer containing a correctly formatted article or BUFFER is nil. The "Xref" and "Lines" headers do not need to contain valid data since they will be recomputed. The "Message-ID" header will also be replaced if OLD-GROUP-ARTICLE is not nil. If a "Newsgroups" header exists, it will be adjusted to agree with the new "Xref" header. If BUFFER is nil and NEW-GROUP-ARTICLE is non-nil, then OLD-GROUP-ARTICLE must be non-nil, in which case one of the articles (all probably identical) it specifies will be used. If optional parameter DONT-SAVE is non-nil, avoids saving the active file and NOV database files if possible. If optional parameter DONT-ADD-EXTRAS-TO-NEW is non-nil, the "extra" group article pairs are not added to NEW-GROUP-ALIST. Returns no data (i.e., doesn't do anything to nntp-server-buffer). The return value is nil if the operation fails. The reason for a failure may be recovered via nnchoke-status-message. If the operation succeeds, the return value depends on whether NEW-GROUP-ARTICLE is non-nil. If NEW-GROUP-ARTICLE is nil, the return value is t, otherwise the return value will be the same as NEW-GROUP-ARTICLE except the nil values will be replaced by the article numbers actually used. This function destructively modifies NEW-GROUP-ARTICLE and the contents of BUFFER. ---------------------------------------------------------------------- EXAMPLES OF HOW TO USE THE *-request-modify-article INTERFACE In these examples, assume that at the start there exists an article crossposted to groups in the "serv" virtual server of the nnchoke back end as given by this Xref header: Xref: foo.bar.com abcdef:412 ghijkl:398 mnopqrs:43 (nnchoke-request-modify-article SERVER OLD-GROUP-ARTICLE NEW-GROUP-ARTICLE BUFFER &optional DONT-SAVE DONT-ADD-EXTRAS-TO-NEW)' To add an additional crossposting of the article in group "zyxwvu": (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) '(("abcdef" . 412) ("zyxwvu")) nil) To remove all copies of the article: (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) nil nil nil t) To replace the crossposting in group "abcdef" by one in "zyxwvu" without affecting the other crosspostings: (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) '(("zyxwvu")) nil) To replace all of the crosspostings of the article by one in "zyxwvu": (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) '(("zyxwvu")) nil nil t) To replace all of the crosspostings of the article by crosspostings determined by consulting nnmail-split-methods: (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) t nil nil t) To add additional crosspostings determined by consulting nnmail-split-methods without affecting the existing crosspostings: (nnchoke-request-modify-article "serv" '(("abcdef" . 412)) '(t ("abcdef" . 412)) nil) With any of these examples, one can supply a buffer for the 4th argument to simultaneously change the body and/or headers of the article. To add a new article to the system (or copy an old article) into group "zyxwvu" using the headers and body in BUFFER: (nnchoke-request-modify-article "serv" nil '(("zyxwvu")) BUFFER) To add a new article to the system (or copy an old article) using groups determined by consulting nnmail-split-methods and using the headers and body in BUFFER: (nnchoke-request-modify-article "serv" nil t BUFFER) ---------------------------------------------------------------------- DESCRIPTION OF CHANGES (in pseudo-ChangeLog format) gnus-sum.el: New Summary mode keybindings: B D gnus-summary-backend-delete-map B D d gnus-summary-delete-article B D a gnus-summary-delete-article-crosspostings-also B D o gnus-summary-delete-article-other-crosspostings-only gnus-summary-move-article: Reimplemented using new *-request-modify-article interface. No longer uses *-request-move or *-request-accept. Doc string is now complete, including correct description of crosspost and copy behavior specified by the ACTION parameter. Fixes these problems/bugs: New articles were not crossposted with the source article (or preexisting articles already crossposted with the source article) when possible, even when ACTION was crosspost. (There was code to do this, it was just broken in a number of different ways.) Xref headers in article files were sometimes left different from the value in the NOV file. (This happened for pre-existing articles that were crossposted with the source article.) Corrupt Xref headers were generated. (Spaces were missing.) Marks in the wrong group could be updated after a move. Marks were not propagated when ACTION was crosspost. Would propagate marks when ACTION was copy. Would leave dangling Xref links. (The Xref header would point to nonexistent articles. This was not a serious problem since Gnus is accustomed to dealing with this in the case of expired articles.) If the code for handling Xref links when crossposting had worked at all, it could have done crossposts across multiple back ends and created Xref lines which mentioned the same newsgroup twice! These would be serious semantic errors. Did not update the various copies of an article's header vector in active summary buffers. Did not flush the old version of an article (with the old Xref header) from various caches (backlog, async prefetch, original-article-buffer). *** Still not fixed for the "cache". *** Did not check that at most one of TO-GROUP and SELECT-METHOD were non-nil. I'm still working on fixing these problems: Marks are never propagated to new groups created as part of the move. Does not update the Xref header in the Article buffer if viewing the article in question. gnus-summary-delete-article-crosspostings-also: New function. gnus-summary-delete-article-other-crosspostings-only: New function. gnus-summary-delete-article: Added optional parameter CROSSPOSTINGS to support previous two functions. Reimplemented using *-request-modify-article for two reasons: 1. Supporting previous two functions. 2. Fix bug where Xref headers were not kept up-to-date. (This is less important.) Doc string now explains return value. nnml.el: nnml-request-move-article, nnml-request-accept-article, nnml-request-replace-article: Completely reimplemented using nnml-request-modify-article. nnml-request-modify-article: New function. Preserves Xref headers properly in both articles and NOV files. Can add new crosspostings to an existing article. Subsumes functionality of *-request-move-article, *-request-accept-article, and *-request-replace-article interfaces, but also allows much more with a very easy-to-use interface. New interface is completely documented in the doc string in a form suitable for pasting into the manual section on back-end interfaces. (Interface specification included below at end of this file.) Fixes bug where LAST parameter of nnml-request-move-article or nnml-request-accept-article might be t but the NOV files and active list are not flushed to disk due to an error causing an abort before the flushing code is reached. nnml-validate-existing-gaa, nnml-validate-potential-gaa, nnml-verify-writable-gaa, nnml-create-gaa-groups, nnml-allocate-gaa-article-numbers, nnml-delete-gaa, nnml-gaa-difference, nnml-gaa-union, nnml-find-other-crossrefs-for-gaa, nnml-article-header, nnml-article-message-id: New functions used by nnml-request-modify-article. nnml-add-nov: Wrote complete doc string. Extended to also be able to set the NOV entry for an arbitrary article number, existing or not. Still runs fast for append case. gnus-int.el: gnus-request-modify-article: New function. Written in the standard manner for a back-end interface wrapper. Only non-trivial aspect: It changes its method argument into a server name (i.e., address) argument. ----------------------------------------------------------------------