Gnus development mailing list
 help / color / mirror / Atom feed
* patch: create nonexistent groups in nnmaildir-save-mail
@ 2001-12-25 23:59 Paul Jarc
  2001-12-26  0:52 ` Harry Putnam
  2001-12-26  1:31 ` Harry Putnam
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Jarc @ 2001-12-25 23:59 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

Oops.  I had thought nnmail took care of this.
	* nnmaildir.el (nnmaildir-save-mail): create the destination
	groups if they do not exist.


paul

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnmaildir.patch --]
[-- Type: text/x-patch, Size: 2743 bytes --]

Index: lisp/nnmaildir.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmaildir.el,v
retrieving revision 6.3
diff -u -r6.3 nnmaildir.el
--- lisp/nnmaildir.el	2001/12/21 23:13:00	6.3
+++ lisp/nnmaildir.el	2001/12/26 00:11:36
@@ -37,7 +37,7 @@
 ;; * We make it easy to manipulate marks, etc., from outside Gnus.
 ;; * All information about a group is stored in the maildir, for easy
 ;;   backup and restoring.
-;; * Use the filesystem as a database.
+;; * We use the filesystem as a database.
 ;;
 ;; Todo:
 ;; * Ignore old NOV data when gnus-extra-headers has changed.
@@ -1383,18 +1383,23 @@
   (catch 'return
     (if group-art nil
       (throw 'return nil))
-    (let ((group-art group-art)
-          x nnmaildir--file deactivate-mark)
+    (let ((ret group-art)
+          ga gname x groups nnmaildir--file deactivate-mark)
       (save-excursion
         (goto-char (point-min))
         (save-match-data
           (while (looking-at "From ")
             (replace-match "X-From-Line: ")
             (forward-line 1))))
-      (setq x (caar group-art) group-art (cdr group-art))
-      (if (nnmaildir-request-accept-article x) nil
-        (throw 'return nil)) ; not that nnmail bothers to check
-      (setq x (nnmaildir--prepare nil x)
+      (setq groups (nnmaildir--srv-get-groups nnmaildir--cur-server)
+            ga (car group-art) group-art (cdr group-art)
+            gname (car ga))
+      (or (intern-soft gname groups)
+          (nnmaildir-request-create-group gname)
+          (throw 'return nil)) ;; not that nnmail bothers to check :(
+      (if (nnmaildir-request-accept-article gname) nil
+        (throw 'return nil))
+      (setq x (nnmaildir--prepare nil gname)
             nnmaildir--file (nnmaildir--srv-get-dir nnmaildir--cur-server)
             nnmaildir--file (concat nnmaildir--file
                                     (nnmaildir--grp-get-name x))
@@ -1406,10 +1411,13 @@
                                     (nnmaildir--art-get-prefix x)
                                     (nnmaildir--art-get-suffix x)))
       (while group-art
-        (setq x (caar group-art) group-art (cdr group-art))
-        (if (nnmaildir-request-accept-article x) nil
-          (throw 'return nil))))
-    group-art))
+        (setq ga (car group-art) group-art (cdr group-art)
+              gname (car ga))
+        (if (and (or (intern-soft gname groups)
+                     (nnmaildir-request-create-group gname))
+                 (nnmaildir-request-accept-article gname)) nil
+          (setq ret (delq ga ret)))) ;; We'll still try the other groups
+      ret)))
 
 (defun nnmaildir-active-number (group)
   (let ((x (nnmaildir--prepare nil group)))

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-12-26 19:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-25 23:59 patch: create nonexistent groups in nnmaildir-save-mail Paul Jarc
2001-12-26  0:52 ` Harry Putnam
2001-12-26 16:37   ` Paul Jarc
2001-12-26 16:57     ` ShengHuo ZHU
2001-12-26  1:31 ` Harry Putnam
2001-12-26 16:53   ` Paul Jarc
2001-12-26 17:37     ` Harry Putnam
2001-12-26 19:20       ` Harry Putnam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).