[fetchmail]I have this idea for a neat feature. Will you add it?

Matthias Andree matthias.andree@gmx.de
Fri, 31 Mar 2006 15:13:53 +0200


--=-=-=

tbrown@nrri.umn.edu writes:

> Fetchmail's great, use it all the time.
>
> It would be nice if the output from 'tracepolls' included the folder
> name (when you're pulling multiple folders using 'folders').
>
> I'm using 'folders inbox,"Junk E-mail"' to pull from two folders, but
> without using separate 'poll' statements and fiddling with the 'mda'
> command I can't see how to preserve the folder of origin information
> (seeing the IMAP server doesn't add anything to preserve the info.).

Does the attached patch work for you?

-- 
Matthias Andree

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=tracepolls-folder.patch
Content-Description: add folder information to tracepolls headers

Index: transact.c
===================================================================
--- transact.c	(Revision 4744)
+++ transact.c	(Arbeitskopie)
@@ -1190,6 +1190,10 @@
 			" polling %s account %s",
 			ctl->server.pollname,
 			ctl->remotename);
+		if (ctl->folder)
+		    snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+			    " folder %s",
+			    ctl->folder);
 	    }
 	    snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), ")\r\n");
 	    n = stuffline(ctl, buf);
Index: fetchmail.h
===================================================================
--- fetchmail.h	(Revision 4743)
+++ fetchmail.h	(Arbeitskopie)
@@ -359,6 +359,7 @@
     struct idlist *oldsaved, *newsaved;
     struct idlist **oldsavedend;
     char lastdigest[DIGESTLEN];	/* last MD5 hash seen on this connection */
+    char *folder;		/* folder currently being polled */
 
     /* internal use -- per-message state */
     int mimemsg;		/* bitmask indicating MIME body-type */
Index: driver.c
===================================================================
--- driver.c	(Revision 4750)
+++ driver.c	(Arbeitskopie)
@@ -1297,6 +1297,7 @@
 	/* now iterate over each folder selected */
 	for (idp = ctl->mailboxes; idp; idp = idp->next)
 	{
+	    ctl->folder = idp->id;
 	    pass = 0;
 	    do {
 		dispatches = 0;
@@ -1568,6 +1569,7 @@
 
 closeUp:
     xfree(msgsizes);
+    ctl->folder = NULL;
 
     /* execute wrapup command, if any */
     if (ctl->postconnect && (tmperr = system(ctl->postconnect)))

--=-=-=--