Package: getmail4
Version: 4.3.10-1
Severity: normal

  The included retrievers don't help you much if you want or need to use
SSL and your POP server has "broken" UIDLs.  The attached patch adds a
retriever that Works For Me.

  Daniel

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-386
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages getmail4 depends on:
ii  debconf                       1.4.58     Debian configuration management sy
ii  python                        2.3.5-3    An interactive high-level object-o

getmail4 recommends no packages.

-- no debconf information
--- /tmp/getmail4-4.3.10/getmailcore/retrievers.py      2005-04-08 
06:33:17.000000000 -0700
+++ /usr/lib/python2.3/site-packages/getmailcore/retrievers.py  2005-10-06 
12:48:55.000000000 -0700
@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.3
 '''Classes implementing retrievers (message sources getmail can retrieve mail
 from).
 
@@ -138,6 +137,68 @@
             + os.linesep)
 
 #######################################
+class BrokenUIDLPOP3SSLRetriever(POP3RetrieverBase, POP3SSLinitMixIn):
+    '''Retriever class for single-user POP3 mailboxes on servers that do not
+    properly assign unique IDs to messages.  Since with these broken servers
+    we cannot rely on UIDL, we have to use message numbers, which are unique
+    within a POP3 session, but which change across sessions.  This class
+    therefore can not be used to leave old mail on the server and download
+    only new mail.
+    '''
+    _confitems = (
+        {'name' : 'configparser', 'type' : types.InstanceType, 'default' : 
None},
+        {'name' : 'getmaildir', 'type' : str, 'default' : '~/.getmail/'},
+
+        {'name' : 'timeout', 'type' : int, 'default' : 180},
+        {'name' : 'server', 'type' : str},
+        {'name' : 'port', 'type' : int, 'default' : POP3_ssl_port},
+        {'name' : 'username', 'type' : str},
+        {'name' : 'password', 'type' : str, 'default' : None},
+        {'name' : 'use_apop', 'type' : bool, 'default' : False},
+        {'name' : 'keyfile', 'type' : str, 'default' : None},
+        {'name' : 'certfile', 'type' : str, 'default' : None},
+    )
+    received_from = None
+    received_with = 'POP3-SSL'
+    received_by = localhostname()
+
+    def _read_oldmailfile(self):
+        '''Force list of old messages to be empty by making this a no-op, so
+        duplicated IDs are always treated as new messages.'''
+        self.log.trace()
+
+    def write_oldmailfile(self, **kwargs):
+        '''Short-circuit writing the oldmail file.'''
+        self.log.trace()
+
+    def _getmsglist(self):
+        '''Don't rely on UIDL; instead, use just the message number.'''
+        self.log.trace()
+        try:
+            response, msglist, octets = self.conn.list()
+            for line in msglist:
+                msgnum = int(line.split()[0])
+                msgsize = int(line.split()[1])
+                self.msgids.append(msgnum)
+                self.msgsizes[msgnum] = msgsize
+        except poplib.error_proto, o:
+            raise getmailOperationError('POP error (%s)' % o)
+        self.gotmsglist = True
+
+    def __str__(self):
+        self.log.trace()
+        return 'BrokenUIDLPOP3SSLRetriever:[EMAIL PROTECTED]:%s' % (
+            self.conf.get('username', 'username'),
+            self.conf.get('server', 'server'),
+            self.conf.get('port', 'port')
+        )
+
+    def showconf(self):
+        self.log.trace()
+        self.log.info('BrokenUIDLPOP3SSLRetriever(%s)' % self._confstring()
+            + os.linesep)
+
+#######################################
 class SimplePOP3SSLRetriever(POP3RetrieverBase, POP3SSLinitMixIn):
     '''Retriever class for single-user POP3-over-SSL mailboxes.
     '''

Attachment: signature.asc
Description: Digital signature

Reply via email to