[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Success, except for splitting




(The mailing list is currently down, it will be back up on monday..)

Donald Hunter <dhunter@atlan-tech.com> writes:

> 1. With nnimap-split-crosspost switched on, it would only split to
> the first rule if non-nil.
> 
> 2. With nnimap-split-crosspost switched off, it would work fine
> unless none of the rules matched.

Try the attached diff. The problem is nnimap-split-to-groups returning
a list containing nil's in the first place.

(It's added to 0.3.14)

> 3. nnimap-split-articles appears to be processing every
> nnimap-split-inbox for each nnimap group I am subscribed to.

Uhm, you're right, but I don't think your fix is the right thing to
do, it assumes that nnimap-request-scan (aka nnimap-split-articles) is
called on the IMAP mailbox that we split from, this is not certainly
the case. If it isn't, no splitting will occur at all.

I think we have to do it this way -- a request-scan on a group should
do what it takes to add articles to that group, and that is
splitting. Either you'll have to make sure all articles in INBOX are
marked as READ (only UNSEEN articles are subject to splitting) or add
a empty regexp to move articles out of INBOX (to INBOX.spam perhaps).

(One solution would be to have nnimap remember what articles in INBOX
it has run through the splitting process and don't run on them again,
but I'm not sure were we could store that information)

> Is EXPUNGE implemented ?

Not in 0.3.13.

/s

--- nnimap.el-  Sat Aug  1 16:05:23 1998
+++ nnimap.el   Sat Aug  1 16:12:54 1998
@@ -695,17 +695,18 @@
          (error "Couldn't remove Seen flag on article %s:%d (you might have unread mail flagged as read!)" group article))))))
 
 ;; tries to match all rules in nnimap-split-rule against content of 
-;; nntp-server-buffer, returns a list of groups that matched. List will 
-;; contain nil, which should be disregarded. (todo: fix nil's)
+;; nntp-server-buffer, returns a list of groups that matched.
 (defun nnimap-split-to-groups ()
+  (let (to-groups)
   (with-current-buffer nntp-server-buffer
     (mapcar (lambda (rule) 
              (let ((group (car rule))
                    (regexp (cadr rule)))
                (goto-char (point-min))
                (when (re-search-forward regexp nil t)
-                 group)))
-           (with-current-buffer nnimap-server-buffer nnimap-split-rule))))
+                 (setq to-groups (cons group to-groups)))))
+           nnimap-split-rule)
+      (reverse to-groups))))
 
 ;; 47
 (defun nnimap-split-articles (&optional group server)
@@ -730,9 +731,8 @@
                        (while (setq to-group (pop groups))
                          (nnimap-split-move-article article inbox to-group)))
                    ;; move to first non-nil box
-                   (let ((group (until (pop groups))))
-                     (nnimap-split-move-article article inbox 
-                                                group))))))))))))
+                   (nnimap-split-move-article article inbox 
+                                              (car groups))))))))))))
 
 ;; nnimap-request-scan doesn't need to do anything. the delivery agent
 ;; program is responsible for putting new message in the imap folders.