aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/007705.html
blob: 88f85ecfdbd0f7664b2552d2ac5092650fd375de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [fetchmail] Patch for IMAP idling where idling is unsupported
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:fetchmail-friends%40cmb.is-a-geek.org">
   <META NAME="robots" CONTENT="index,nofollow">
   
   <LINK REL="Previous"  HREF="007711.html">
   <LINK REL="Next"  HREF="007713.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[fetchmail] Patch for IMAP idling where idling is unsupported
   </H1>
    <B>Chris Boyle
    </B> 
    <A HREF="mailto:fetchmail-friends%40cmb.is-a-geek.org"
       TITLE="[fetchmail] Patch for IMAP idling where idling is unsupported">fetchmail-friends@cmb.is-a-geek.org
       </A><BR>
    <I>21 Jul 2003 18:20:43 +0100</I>
    <P><UL>
        <LI> Previous message: <A HREF="007711.html">[fetchmail] Problem - truncated messages
</A></li>
        <LI> Next message: <A HREF="007713.html">[fetchmail] Patch for IMAP idling where idling is unsupported
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#7705">[ date ]</a>
              <a href="thread.html#7705">[ thread ]</a>
              <a href="subject.html#7705">[ subject ]</a>
              <a href="author.html#7705">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Here's a patch I've written: where IDLE is unavailable, it uses periodic
NOOP commands instead (every 28 seconds). Important behavioural change:
the option &quot;idle&quot; will now always result in *some* form of idle. I think
I read somewhere that some servers will unilaterally send status updates
if you just hold the connection open, i.e. NOOPs would be unnecessary,
but that doesn't seem to be the case anywhere I've tried. In any case,
this patch copes with updates both as a response to the NOOPs and
unilaterally sent between them. It functions exactly like normal idling
(N.B. like normal idling, it is single-folder only), and hopefully
includes all the appropriate changes to the documentation. Enjoy. :-)

<A HREF="http://cmb.is-a-geek.org/downloads/fetchmail-6.2.2+noopidle.diff.gz">http://cmb.is-a-geek.org/downloads/fetchmail-6.2.2+noopidle.diff.gz</A>

-- 
Chris Boyle - <A HREF="http://people.debian.org/~cmb/">http://people.debian.org/~cmb/</A>
GPG: B7D86E0F, MSN: <A HREF="mailto:shortcipher@hotmail.com">shortcipher@hotmail.com</A>, ICQ: 24151961,
AIM: kerneloops, Yahoo: kerneloops, IRC: cmb on freenode.net

</PRE>
<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="007711.html">[fetchmail] Problem - truncated messages
</A></li>
	<LI> Next message: <A HREF="007713.html">[fetchmail] Patch for IMAP idling where idling is unsupported
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#7705">[ date ]</a>
              <a href="thread.html#7705">[ thread ]</a>
              <a href="subject.html#7705">[ subject ]</a>
              <a href="author.html#7705">[ author ]</a>
         </LI>
       </UL>
</body></html>
t 1 chgrp mail $mbox || exit 1 umask $oldumask fi # First lock the mailbox, if this doesn't succeed in 64 seconds, give up and send # mail to postmaster. # If this period is to short, increase the retries (-r flag to lockfile) # # Then run the message through formail to get it into the right mailbox format with the # right headers added. # # Delivered-To will make fetchmail propagate this mail to the correct user when # run with '-E "Delivered-To"'. Set this in the advanced settings of the TeamInternet f.i. # (if you changed the envelope at the start of this script, adapt this accordingly) # # We also muck up the messageid, so fetchmail will never skip a message on the basis of # duplicate messageIDs. The -i "Message-ID" will rename the old message ID, the -a will # add a new one. # # Lastly, we add a header indicating which host did the rewriting. # if lockfile -r 8 $mbox.lock >/dev/null 2>&1 then cat - | formail -i "$envelope <$to>" -i "Message-ID:" -a "Message-ID:" -i "X-Multidrop-Processing: <`hostname`>" >>$mbox rm -f $mbox.lock else (echo "Subject: Cannot lock mailbox for $user" & cat -) | /usr/lib/sendmail postmaster fi # # EOF # This obviously is very Linux (even RedHat?) dependant, locking mailboxes, creating mailboxes with the right permissions, probably even bash dependent. I would say that it should be fairly easy to port to other systems, but alas, my unix knowledge is lacking for that. I'll also rewrite it someday, a.o. that umask handling can be done much better and the location of the sendmail binairy should not be fixed. Now the only thing left to do is to retrieve the mail with fetchmail, using 'envelope "Delivered-To:"' in the poll line. The above script has added this line, so this is all that fetchmail needs. All parts of this solution need carefull examination. In particular I think the new rule lines may not catch all cases, although they worked for everything I threw at them and work satisfactorily in production. I'm also wondering if there is a more standard way to drop something in a mailbox. I yet have to investigate procmail, but all other MDA's mucked with the message and effectively undid my carefully added header. I'll experiment some more and rethink it all as I learn more. I'm still wondering, if I can get formail to include another received line.... "Received from localhost by dropmail for <user>...." to make it work without the envelope flag. Well I'll have to experiment. Do you know if there is a header I can add so fetchmail works out-of-the-box? Regards, Martijn Lievaart