]> Pileus Git - ~andy/fetchmail/blobdiff - fetchmailconf.py
Attempt merging from 6.3.24.
[~andy/fetchmail] / fetchmailconf.py
index baeb1a0c7305b63c4d6a37b2cf1f786eeda5a434..b4b0a1ae7facd4431a39b776e39cefb071b9ab5e 100755 (executable)
@@ -5,7 +5,7 @@
 # Matthias Andree <matthias.andree@gmx.de>
 # Requires Python with Tkinter, and the following OS-dependent services:
 #      posix, posixpath, socket
-version = "1.55 $Revision$"
+version = "1.58"
 
 from Tkinter import *
 from Dialog import *
@@ -65,6 +65,8 @@ class Configuration:
            str = str + ("set properties \"%s\"\n" % (self.properties,));
        if self.poll_interval > 0:
            str = str + "set daemon " + `self.poll_interval` + "\n"
+       if self.invisible:
+          str = str + ("set invisible\n")
        for site in self.servers:
            str = str + repr(site)
        return str
@@ -86,7 +88,6 @@ class Server:
        self.interval = 0               # Skip interval
        self.protocol = 'auto'          # Default to auto protocol
        self.service = None             # Service name to use
-       self.uidl = FALSE               # Don't use RFC1725 UIDLs by default
        self.auth = 'any'               # Default to password authentication
        self.timeout = 300              # 5-minute timeout
        self.envelope = 'Received'      # Envelope-address header
@@ -103,6 +104,8 @@ class Server:
        self.esmtpname = None           # ESMTP 2554 name
        self.esmtppassword = None       # ESMTP 2554 password
        self.tracepolls = FALSE         # Add trace-poll info to headers
+       self.badheader = FALSE          # Pass messages with bad headers on?
+       self.retrieveerror = 'abort'    # Policy when message retrieval errors encountered
        self.users = []                 # List of user entries for site
        Server.typemap = (
            ('pollname',  'String'),
@@ -111,7 +114,6 @@ class Server:
            ('interval',  'Int'),
            ('protocol',  'String'),
            ('service',   'String'),
-           ('uidl',      'Boolean'),
            ('auth',      'String'),
            ('timeout',   'Int'),
            ('envelope',  'String'),
@@ -127,7 +129,9 @@ class Server:
            ('esmtpname', 'String'),
            ('esmtppassword', 'String'),
            ('principal', 'String'),
-           ('tracepolls','Boolean'))
+           ('tracepolls','Boolean'),
+           ('badheader', 'Boolean'),
+           ('retrieveerror', 'String'))
 
     def dump(self, folded):
        res = ""
@@ -153,12 +157,9 @@ class Server:
            res = res + (" qvirtual " + str(self.qvirtual) + "\n");
        if self.auth != ServerDefaults.auth:
            res = res + " auth " + self.auth
-       if self.dns != ServerDefaults.dns or self.uidl != ServerDefaults.uidl:
-           res = res + " and options"
        if self.dns != ServerDefaults.dns:
+           res = res + " and options"
            res = res + flag2str(self.dns, 'dns')
-       if self.uidl != ServerDefaults.uidl:
-           res = res + flag2str(self.uidl, 'uidl')
        if folded:      res = res + "\n    "
        else:        res = res + " "
 
@@ -195,6 +196,16 @@ class Server:
        if self.esmtppassword:
            res = res + " esmtppassword " + `self.esmtppassword`
        if self.interface or self.monitor or self.principal or self.plugin or self.plugout:
+           if folded:
+               res = res + "\n    "
+
+       if self.badheader:
+               res = res + "bad-header accept "
+       if self.retrieveerror == 'continue':
+               res = res + "retrieve-error continue "
+       if self.retrieveerror == 'markseen':
+               res = res + "retrieve-error markseen "
+       if self.badheader or self.retrieveerror != ServerDefaults.retrieveerror:
            if folded:
                res = res + "\n"
 
@@ -426,8 +437,7 @@ class User:
 #
 
 # IANA port assignments and bogus 1109 entry
-ianaservices = {"pop2":109,
-               "pop3":110,
+ianaservices = {"pop3":110,
                "1109":1109,
                "imap":143,
                "smtp":25,
@@ -435,16 +445,14 @@ ianaservices = {"pop2":109,
 
 # fetchmail protocol to IANA service name
 defaultports = {"auto":None,
-               "POP2":"pop2",
                "POP3":"pop3",
-               "APOP":"pop3",
                "KPOP":"1109",
                "IMAP":"imap",
                "ETRN":"smtp",
                "ODMR":"odmr"}
 
 authlist = ("any", "password", "gssapi", "kerberos", "ssh", "otp",
-           "msn", "ntlm")
+           "msn", "ntlm", "apop", "cram-md5")
 
 listboxhelp = {
     'title' : 'List Selection Help',
@@ -827,14 +835,14 @@ class ConfigurationEdit(Frame, MyWidget):
 
            sb = Frame(gf)
            Checkbutton(sb,
-               {'text':'send spam bounces?',
+               {'text':'Send spam bounces?',
                'variable':self.spambounce,
                'relief':GROOVE}).pack(side=LEFT, anchor=W)
            sb.pack(fill=X)
 
            sb = Frame(gf)
            Checkbutton(sb,
-               {'text':'treat permanent errors as temporary?',
+               {'text':'Treat permanent errors as temporary?',
                'variable':self.softbounce,
                'relief':GROOVE}).pack(side=LEFT, anchor=W)
            sb.pack(fill=X)
@@ -954,6 +962,13 @@ the normal operation of fetchmail when it is run with no arguments.
 If it is off, fetchmail will only query this host when it is given as
 a command-line argument.
 
+The `Retrieve Error Policy' specifies how server errors during
+message retrieval are handled.  The default behaviour is to abort the
+current session.  Both the continue and markseen options will skip
+the message with the error, but continue the session allowing for 
+downloading of subsequent messages.  Additionally, the markseen
+option will mark the skipped message as seen.
 The `True name of server' box should specify the actual DNS name
 to query. By default this is the same as the poll name.
 
@@ -1109,7 +1124,6 @@ class ServerEdit(Frame, MyWidget):
        # a custom port number you should be in expert mode and playing
        # close enough attention to notice this...
        self.service.set(defaultports[proto])
-       if not proto in ("POP3", "APOP", "KPOP"): self.uidl.state = DISABLED
 
     def user_edit(self, username, mode):
        self.subwidgets[username] = UserEdit(username, self).edit(mode, Toplevel())
@@ -1129,6 +1143,11 @@ class ServerEdit(Frame, MyWidget):
            ctlwin = Frame(leftwin, relief=RAISED, bd=5)
            Label(ctlwin, text="Run Controls").pack(side=TOP)
            Checkbutton(ctlwin, text='Poll ' + host + ' normally?', variable=self.active).pack(side=TOP)
+           Checkbutton(ctlwin, text='Pass messages with bad headers?',
+                   variable=self.badheader).pack(side=TOP)
+            retrieveerrorlist = ['abort', 'continue', 'markseen']
+            Label(ctlwin, text="Retrieve Error Policy").pack(side=TOP)
+            ButtonBar(ctlwin, '', self.retrieveerror, retrieveerrorlist, 1, None)
            LabeledEntry(ctlwin, 'True name of ' + host + ':',
                      self.via, leftwidth).pack(side=TOP, fill=X)
            LabeledEntry(ctlwin, 'Cycles to skip between polls:',
@@ -1141,10 +1160,8 @@ class ServerEdit(Frame, MyWidget):
 
        # Compute the available protocols from the compile-time options
        protolist = ['auto']
-       if 'pop2' in feature_options:
-           protolist.append("POP2")
        if 'pop3' in feature_options:
-           protolist = protolist + ["POP3", "APOP", "KPOP"]
+           protolist = protolist + ["POP3", "KPOP"]
        if 'sdps' in feature_options:
            protolist.append("SDPS")
        if 'imap' in feature_options:
@@ -1163,9 +1180,6 @@ class ServerEdit(Frame, MyWidget):
            LabeledEntry(protwin, 'On server TCP/IP service:',
                      self.service, leftwidth).pack(side=TOP, fill=X)
            self.defaultPort()
-           Checkbutton(protwin,
-               text="POP3: track `seen' with client-side UIDLs?",
-               variable=self.uidl).pack(side=TOP)
        Button(protwin, text='Probe for supported protocols', fg='blue',
               command=self.autoprobe).pack(side=LEFT)
        Button(protwin, text='Help', fg='blue',
@@ -1239,7 +1253,7 @@ class ServerEdit(Frame, MyWidget):
        else:
            realhost = self.server.pollname
        greetline = None
-       for protocol in ("IMAP","POP3","POP2"):
+       for protocol in ("IMAP","POP3"):
            service = defaultports[protocol]
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            try:
@@ -1264,18 +1278,6 @@ out before getting a response.
            warnings = ''
            # OK, now try to recognize potential problems
 
-           if protocol == "POP2":
-               warnings = warnings + """
-It appears you have somehow found a mailserver running only POP2.
-Congratulations.  Have you considered a career in archaeology?
-
-Unfortunately, stock fetchmail binaries don't include POP2 support anymore.
-Unless the first line of your fetchmail -V output includes the string "POP2",
-you'll have to build it from sources yourself with the configure
-switch --enable-POP2.
-
-"""
-
 ### POP3 servers start here
 
            if string.find(greetline, "1.003") > 0 or string.find(greetline, "1.004") > 0:
@@ -1490,7 +1492,7 @@ recommend you upgrade to a non-broken IMAP server.
            if string.find(greetline, "Domino IMAP4") > 0:
                warnings = warnings + """
 Your IMAP server appears to be Lotus Domino.  This server, at least up
-to version 4.6.2a, has a bug in its generation of MIME boundaries (see
+to version 5.0.2, has a bug in its generation of MIME boundaries (see
 the details in the fetchmail FAQ).  As a result, even MIME aware MUAs
 will see attachments as part of the message text.  If your Domino server's
 POP3 facility is enabled, we recommend you fall back on it.
@@ -1506,20 +1508,6 @@ It looks like you could use APOP on this server and avoid sending it your
 password in clear.  You should talk to the mailserver administrator about
 this.
 
-"""
-           if string.find(greetline, "IMAP2bis") > 0:
-               warnings = warnings + """
-IMAP2bis servers have a minor problem; they can't peek at messages without
-marking them seen.  If you take a line hit during the retrieval, the
-interrupted message may get left on the server, marked seen.
-
-To work around this, it is recommended that you set the `fetchall'
-option on all user entries associated with this server, so any stuck
-mail will be retrieved next time around.
-
-To fix this bug, upgrade to an IMAP4 server.  The fetchmail FAQ includes
-a pointer to an open-source implementation.
-
 """
            if string.find(greetline, "IMAP4rev1") > 0:
                warnings = warnings + """
@@ -1689,9 +1677,9 @@ class UserEdit(Frame, MyWidget):
            Label(targwin, text="Domains to fetch from (ODMR/ETRN only)").pack(side=TOP)
            ListEdit("Domains:",
                     self.user.fetchdomains, None, None, targwin, None)
-           LabeledEntry(targwin, 'Append to MAIL FROM line:',
+           LabeledEntry(targwin, 'Use domain on RCPT TO line:',
                     self.smtpaddress, '26').pack(side=TOP, fill=X)
-           LabeledEntry(targwin, 'Set RCPT To address:',
+           LabeledEntry(targwin, 'Set fixed RCPT TO address:',
                     self.smtpname, '26').pack(side=TOP, fill=X)
            LabeledEntry(targwin, 'Connection setup command:',
                     self.preconnect, '26').pack(side=TOP, fill=X)
@@ -2085,10 +2073,10 @@ Usage: fetchmailconf {[-d] [-f fetchmailrc]|-h|--help|-V|--version}
            print "fetchmailconf %s" % version
            print """
 Copyright (C) 1997 - 2003 Eric S. Raymond
-Copyright (C) 2005 - 2006 Matthias Andree
+Copyright (C) 2005, 2006, 2008, 2009 Matthias Andree
 fetchmailconf comes with ABSOLUTELY NO WARRANTY.  This is free software, you are
 welcome to redistribute it under certain conditions.  Please see the file
-COPYING in the source or documentation directory for details.  """
+COPYING in the source or documentation directory for details."""
            sys.exit(0)
 
     # Get client host's FQDN