Implementation of IMAP IDLE

- Use a newer version of imaplib
 - Hijack the keepalive process to send IDLE instead of NOOP
This commit is contained in:
James Bunton
2009-02-10 11:27:48 +11:00
parent 8db951ed61
commit 3847d0ba9d
9 changed files with 2204 additions and 112 deletions

View File

@ -20,8 +20,7 @@
"""
from IMAP import IMAPFolder
import imaplib
from offlineimap import imaputil, imaplibutil
from offlineimap import imaplib2, imaputil, imaplibutil
from offlineimap.ui import UIBase
from copy import copy

View File

@ -17,8 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from Base import BaseFolder
import imaplib
from offlineimap import imaputil, imaplibutil
from offlineimap import imaplib2, imaputil, imaplibutil
from offlineimap.ui import UIBase
from offlineimap.version import versionstr
import rfc822, time, string, random, binascii, re
@ -271,13 +270,13 @@ class IMAPFolder(BaseFolder):
raise ValueError
# This could raise a value error if it's not a valid format.
date = imaplib.Time2Internaldate(datetuple)
date = imaplib2.Time2Internaldate(datetuple)
except (ValueError, OverflowError):
# Argh, sometimes it's a valid format but year is 0102
# or something. Argh. It seems that Time2Internaldate
# will rause a ValueError if the year is 0102 but not 1902,
# but some IMAP servers nonetheless choke on 1902.
date = imaplib.Time2Internaldate(time.localtime())
date = imaplib2.Time2Internaldate(time.localtime())
ui.debug('imap', 'savemessage: using date ' + str(date))
content = re.sub("(?<!\r)\n", "\r\n", content)